Blocks::tec_ce_convert_content_to_blocks( int $event_id, array $data, WP_Post $event )
Convert the submitted event data to blocks.
Contents
Parameters
- $event_id
-
(int) (Required) The event ID we are modifying meta for.
- $data
-
(array) (Required) The meta fields we want saved.
- $event
-
(WP_Post) (Required) The event itself.
Return
(void)
Source
File: src/Events_Community/Block_Conversion/Blocks.php
public function tec_ce_convert_content_to_blocks( int $event_id, array $data, WP_Post $event ): void {
// Bail if it's not a Community Event edit.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! isset( $_REQUEST['community-event'] ) ) {
return;
}
if ( ! $this->is_community_event_post( $event_id ) ) {
return;
}
$editor = tribe( Tribe__Events__Editor::class );
$should_load_blocks = (bool) $editor->are_blocks_enabled();
if ( ! $should_load_blocks ) {
// Blocks aren't enabled, bail.
return;
}
$editor->update_post_content_to_blocks( $event_id );
}
Changelog
| Version | Description |
|---|---|
| 4.10.17 | Introduced. |