le name that is parsed to match our block template. */ public function filter_single_template_hierarchy( $templates ) { if ( empty( $templates ) ) { return $templates; } if ( ! is_array( $templates ) ) { return $templates; } // Is it our post type? $index = array_search( 'single-tribe_events.php', $templates, true ); if ( is_int( $index ) ) { // Switch to our faux template which maps to our slug. $templates[ $index ] = 'single-event.php'; } return $templates; } /** * Adds the archive template to the array of block templates. * * @since 5.14.2 * @since 6.2.7 Added support for single event templates. * * @param WP_Block_Template[] $query_result Array of found block templates. * @param array $query { * Optional. Arguments to retrieve templates. * * @type array $slug__in List of slugs to include. * @type int $wp_id Post ID of customized template. * } * * @return array The modified $query. */ public function filter_include_templates( $query_result, $query, $template_type ) { if ( ! is_array( $query_result ) ) { return $query_result; } // Get our block template services for this query. $template_services = $this->get_filtered_block_templates( $template_type ); foreach ( $template_services as $template ) { if ( empty( $query['slug__in'] ) || in_array( $template->slug(), $query['slug__in'], true ) ) { /** * @var WP_Block_Template $wp_template */ $wp_template = $template->get_block_template(); if ( $wp_template ) { $query_result[] = $wp_template; } } } return $query_result; } /** * Fetch our Block Template by ID. * * @since 6.2.7 * * @param null|WP_Block_Template $block_template The filtered template. * @param string $id The block template ID. * @param string $template_type The template type. * * @return null|WP_Block_Template */ public function filter_include_template_by_id( $block_template, $id, $template_type ) { if ( ! is_null( $block_template ) ) { return $block_template; } $template_services = $this->get_filtered_block_templates( $template_type ); foreach ( $template_services as $template ) { if ( $id === $template->id() ) { return $template->get_block_template(); } } return $block_template; } /** * Filters and returns the available Event Block Template Services, used to locate * WP_Block_Template instances. * * @since 6.2.7 * * @param string $template_type The type of templates we are fetching. * * @return Block_Template_Contract[] List of filtered Event Calendar templates. */ public function get_filtered_block_templates( $template_type = 'wp_template' ): array { $templates = []; if ( $template_type === 'wp_template' ) { /** * Filter whether the event archive block template should be used. * * @since 6.4.0 * * @param bool $allow_archive Whether the event archive block template should be used. */ $allow_archive = apply_filters( 'tec_events_allow_archive_block_template', true ); if ( $allow_archive ) { $templates[] = tribe( Archive_Block_Template::class ); } /** * Filter whether the event single block template should be used. * * @since 6.4.0 * * @param bool $allow_single Whether the single block template should be used. */ $allow_single = apply_filters( 'tec_events_allow_single_block_template', true ); if ( $allow_single ) { $templates[] = tribe( Single_Block_Template::class ); } return $templates; } /** * Filter our available Full Site Block Template objects available. These are used in to define and store WP_Block_Template instances. * * @since 6.2.7 * * @param Block_Template_Contract[] $templates The list of our Block_Template_Contracts to be used to register and generate WP_Block_Template. * @param string $template_type The type of template being requested. */ return apply_filters( 'tec_events_get_full_site_block_template_services', $templates, $template_type ); } /** * If we're using a FSE theme, we always use the full styling. * * @since 5.14.2 * * @param string $value The value of the option. * * @return string $value The original value, or an empty string if FSE is active. */ public function filter_events_template_setting_option( $value ) { return tec_is_full_site_editor() ? '' : $value; } /** * Override the get_single_option to return the default event template when FSE is active. * * @since 5.14.2 * * @param mixed $option Results of option query. * @param string $default The default value. * @param string $option_name Name of the option. * * @return mixed results of option query. */ public function filter_tribe_get_single_option( $option, $default, $option_name ) { if ( 'tribeEventsTemplate' !== $option_name ) { return $option; } if ( tec_is_full_site_editor() ) { return ''; } return $option; } /** * Overwrite the template option on save if FSE is active. * We only support the default events template for now. * * @since 5.14.2 * * @param array $options The array of values to save. In the format option key => value. * @param string $option_id The main option ID. * * @return array $options The array of values to save. In the format option key => value. */ public function filter_tribe_save_template_option( $options, $option_id ) { if ( tec_is_full_site_editor() ) { $options['tribeEventsTemplate'] = ''; } return $options; } }
Fatal error: Uncaught TEC\Common\Exceptions\Not_Bound_Exception: Error while making TEC\Events\Block_Templates\Controller: nothing is bound to the 'TEC\Events\Block_Templates\Controller' id and it's not an existing or instantiable class. in /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php:27 Stack trace: #0 /htdocs/wp-content/plugins/the-events-calendar/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(460): TEC\Common\Contracts\Container->get('TEC\\Events\\Bloc...') #1 /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php(46): TEC\Common\lucatume\DI52\Container->register('TEC\\Events\\Bloc...') #2 /htdocs/wp-content/plugins/the-events-calendar/common/src/Tribe/Container.php(305): TEC\Common\Contracts\Container->register('TEC\\Events\\Bloc...') #3 /htdocs/wp-content/plugins/the-events-calendar/src/Tribe/Main.php(684): tribe_register_provider('TEC\\Events\\Bloc...') #4 /htdocs/wp-content/plugins/the-events-calendar/src/Tribe/Main.php(530): Tribe__Events__Main->bind_implementations() #5 /htdocs/wp-includes/class-wp-hook.php(324): Tribe__Events__Main->bootstrap('') #6 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #7 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #8 /htdocs/wp-content/plugins/the-events-calendar/common/src/Tribe/Main.php(128): do_action('tribe_common_lo...') #9 /htdocs/wp-includes/class-wp-hook.php(324): Tribe__Main->plugins_loaded('') #10 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #11 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /htdocs/wp-settings.php(506): do_action('plugins_loaded') #13 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #14 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #15 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #16 /htdocs/index.php(17): require('/htdocs/wp-blog...') #17 {main} thrown in /htdocs/wp-content/plugins/the-events-calendar/common/src/Common/Contracts/Container.php on line 27