Tribe__Tickets__Editor::add_tickets_block_in_editor()

Adds the ticket block into the editor


Parameters

$template

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

$post_type

(string) (Required) The current post type


Top ↑

Return

(array)


Top ↑

Source

File: src/Tribe/Editor.php

	public function add_tickets_block_in_editor() {
		// Post types where the block shouldn't be displayed by default
		if ( ! class_exists( 'Tribe__Events__Main' ) ) {
			return;
		}

		foreach ( $this->get_enabled_post_types() as $post_type ) {
			$post_type_object = get_post_type_object( $post_type );

			if ( ! $post_type_object || $post_type !== Tribe__Events__Main::POSTTYPE ) {
				continue;
			}

			$template = isset( $post_type_object->template )
				? (array) $post_type_object->template
				: array();

			$template[] = array( 'tribe/tickets' );
			$template[] = array( 'tribe/rsvp' );
			$template[] = array( 'tribe/attendees' );

			$post_type_object->template = $template;
		}
	}

Top ↑

Changelog

Changelog
Version Description
4.9 Introduced.