Provider::add_event_template_blocks( array $template, string $post_type, TribeEventsVirtualEditorarray $args )

Adds the required blocks into the Events Post Type default templates.


Parameters

$template

(array) (Required) Array of all the templates used by default.

$post_type

(string) (Required) Which post type we are filtering.

$args

(<span class="TribeEventsVirtualEditorarrayTribeEventsVirtualEditorarray<string|">TribeEventsVirtualEditormixed>) (Required) Array of configurations for the post type.


Top ↑

Return

(array) $template Modified arguments used to setup the CPT template.


Top ↑

Source

File: src/Tribe/Editor/Provider.php

	public function add_event_template_blocks( $template, $post_type, $args ) {
		$post = tribe_get_request_var( 'post' );
		$is_classic_editor = ! has_blocks( $post );

		// Basically sets up up a different template if this is a classic event.
		if ( $is_classic_editor ) {
			return $template;
		}

		return $template;

		// To be safe, ensure we have an array.
		if ( ! is_array( $template ) ) {
			$template = (array) $template;
		}

		/**
		 * Allow modifying the default block template for Virtual Events.
		 *
		 * @since 1.7.1
		 *
		 * @param  array               $template   Array of the templates we're adding.
		 * @param  string              $post_type  Which post type we are filtering.
		 * @param  array<string|mixed> $args       Array of configurations for the post type.
		 */
		$virtual_template = apply_filters( 'tribe_events_editor_default_virtual_template', [ 'tribe/virtual-event' ], TEC::POSTTYPE, $args );

		// Add our new template to the mix.
		$template[] = $virtual_template;

 		return $template;
	}

Top ↑

Changelog

Changelog
Version Description
1.7.1
1.12.0 Introduced.