Tribe__Events__Editor::add_event_template_blocks( array $args = array() )
Adds the required blocks into the Events Post Type
Contents
Parameters
- $args
-
(array) (Optional) Arguments used to setup the CPT template
Default value: array()
Return
(array)
Source
File: src/Tribe/Editor.php
public function add_event_template_blocks( $args = array() ) {
$template = array();
$post = tribe_get_request_var( 'post' );
$is_classic_editor = ! empty( $post ) && is_numeric( $post ) && ! has_blocks( $post );
// Basically setups up a different template if is a classic event
if ( $is_classic_editor ) {
$template = $this->get_classic_template();
} else {
$template[] = array( 'tribe/event-datetime' );
$template[] = array(
'core/paragraph',
array(
'placeholder' => __( 'Add Description...', 'the-events-calendar' ),
),
);
$template[] = array( 'tribe/event-price' );
$template[] = array( 'tribe/event-organizer' );
$template[] = array( 'tribe/event-venue' );
$template[] = array( 'tribe/event-website' );
$template[] = array( 'tribe/event-links' );
}
/**
* Allow modifying the default template for Events
*
* @since 4.7
*
* @param array $template Array of all the templates used by default
* @param string $post_type Which post type we are filtering
* @param array $args Array of configurations for the post type
*
*/
$args['template'] = apply_filters( 'tribe_events_editor_default_template', $template, Tribe__Events__Main::POSTTYPE, $args );
return $args;
}
Changelog
| Version | Description |
|---|---|
| 4.7 | Introduced. |