Blocks::tribe_events_editor_default_classic_template( array $template )

Filters and adjusts the template array for classic templates.

Removes ‘classic-event-details’ blocks and ensures that an ‘event-organizer’ block is included in the template array.


Parameters

$template

(array) (Required) The original template blocks array.


Top ↑

Return

(array) The modified template array.


Top ↑

Source

File: src/Events_Community/Block_Conversion/Blocks.php

	public function tribe_events_editor_default_classic_template( array $template ): array {
		$transformations = [
			'tribe/event-links' => 'tribe/event-website',
		];

		$required_blocks = [
			'tribe/event-organizer',
			'tribe/event-website',
			'tribe/event-price',
		];

		$new_template   = [];
		$present_blocks = [];

		foreach ( $template as $block ) {
			if ( 'tribe/classic-event-details' === $block[0] ) {
				continue;
			}

			$block[0] = $transformations[ $block[0] ] ?? $block[0];

			$new_template[]   = $block;
			$present_blocks[] = $block[0];
		}

		// Ensure required blocks are added if they were missing.
		foreach ( $required_blocks as $required_block ) {
			if ( ! in_array( $required_block, $present_blocks ) ) {
				$new_template[] = [ $required_block ];
			}
		}

		return $new_template;
	}

Top ↑

Changelog

Changelog
Version Description
4.10.17 Introduced.