Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::get_block_template()
Checks if we can fall back to the archive-product template for a given slug.
taxonomy-product_cat, taxonomy-product_tag, taxonomy-product_attribute templates can generally use the archive-product as a fallback if there are no specific overrides.
Метод класса: BlockTemplateUtils{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = BlockTemplateUtils::template_is_eligible_for_product_archive_fallback( $template_slug );
- $template_slug(строка) (обязательный)
- Slug to check for fallbacks.
Код BlockTemplateUtils::get_block_template() BlockTemplateUtils::get block template WC 8.7.0
public static function template_is_eligible_for_product_archive_fallback( $template_slug ) { return in_array( $template_slug, self::ELIGIBLE_FOR_ARCHIVE_PRODUCT_FALLBACK, true ); } /** * Checks if we can fall back to an `archive-product` template stored on the db for a given slug. * * @param string $template_slug Slug to check for fallbacks. * @param array $db_templates Templates that have already been found on the db. * @return boolean */ public static function template_is_eligible_for_product_archive_fallback_from_db( $template_slug, $db_templates ) {