Tribe__Events__Editor__Template__Overwrite::include_blocks( string $silence )
After tribe_events_before_view we will include the blocks template for Single Events
Contents
Parameters
- $silence
-
(string) (Required) Unused file path, since it's always the same for Blocks editor
Return
(string)
Source
File: src/Tribe/Editor/Template/Overwrite.php
public function include_blocks( $silence ) {
// Prevent printing anything for events that don't have silence
if ( $silence !== $this->get_path( 'silence' ) ) {
return false;
}
$post_id = get_the_ID();
// Prevent printing for posts that doesn't have Blocks
if ( ! has_blocks( $post_id ) ) {
return $silence;
}
$args = array(
'post_id' => $post_id,
'post' => get_post( $post_id ),
);
// Set globals to allow better usage of render method for each block
tribe( 'events.editor.template' )->add_template_globals( $args );
return tribe( 'events.editor.template' )->template( 'single-event-blocks' );
}
Changelog
| Version | Description |
|---|---|
| 4.7 | Introduced. |