WC_Template_Loader::has_block_templateprivate staticWC 5.5.0

Checks whether a block template with that name exists.

Note: This checks both the templates and block-templates directories as both conventions should be supported.

Метод класса: WC_Template_Loader{}

Хуки из метода

Возвращает

true|false.

Использование

$result = WC_Template_Loader::has_block_template( $template_name );
$template_name(строка) (обязательный)
Template to check.

Список изменений

С версии 5.5.0 Введена.

Код WC_Template_Loader::has_block_template() WC 10.4.3

private static function has_block_template( $template_name ) {
	if ( ! $template_name ) {
		return false;
	}

	$has_template = WP_Block_Templates_Registry::get_instance()->is_registered( 'woocommerce//' . $template_name );

	/**
	 * Filters the value of the result of the block template check.
	 *
	 * @since 10.2.0
	 *
	 * @param boolean $has_template value to be filtered.
	 * @param string $template_name The name of the template.
	 */
	return (bool) apply_filters( 'woocommerce_has_block_template', $has_template, $template_name );
}