Tribe__Events__Meta__Save::save()
Save the meta for the event if the user has the capability to.
Return
(bool) true if event meta was updated, false otherwise.
Source
File: src/Tribe/Meta/Save.php
public function save() {
/** @var Tribe__Editor $editor */
$editor = tribe( 'editor' );
/** @var Tribe__Events__Editor__Compatibility $compatibility */
$compatibility = tribe( 'events.editor.compatibility' );
$has_gutenberg_editor = $compatibility->is_blocks_editor_toggled_on() && ! $editor->is_classic_plugin_active();
// Save only the meta that does not have blocks when the Gutenberg editor is present.
if ( tribe( 'tec.gutenberg' )->should_display() && $has_gutenberg_editor ) {
return $this->save_block_editor_metadata( $this->post_id, $_POST, $this->post );
}
if ( ! $this->context->has_nonce() ) {
return false;
}
if ( ! $this->context->verify_nonce() ) {
return false;
}
if ( ! $this->context->current_user_can_edit_events() ) {
return false;
}
$_POST['Organizer'] = isset( $_POST['organizer'] ) ? stripslashes_deep( $_POST['organizer'] ) : null;
$_POST['Venue'] = isset( $_POST['venue'] ) ? stripslashes_deep( $_POST['venue'] ) : null;
/**
* handle previewed venues and organizers
*/
$this->manage_preview_metapost( 'venue', $this->post_id );
$this->manage_preview_metapost( 'organizer', $this->post_id );
Tribe__Events__API::saveEventMeta( $this->post_id, $_POST, $this->post );
return true;
}