Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::get_fallback_template_from_db()
Gets the archive-product fallback template stored on the db for a given slug.
Метод класса: BlockTemplateUtils{}
Хуков нет.
Возвращает
true|false|Объект
.
Использование
$result = BlockTemplateUtils::get_fallback_template_from_db( $template_slug, $db_templates );
- $template_slug(строка) (обязательный)
- Slug to check for fallbacks.
- $db_templates(массив) (обязательный)
- Templates that have already been found on the db.
Код BlockTemplateUtils::get_fallback_template_from_db() BlockTemplateUtils::get fallback template from db WC 8.7.0
public static function get_fallback_template_from_db( $template_slug, $db_templates ) { $eligible_for_fallback = self::template_is_eligible_for_product_archive_fallback( $template_slug ); if ( ! $eligible_for_fallback ) { return false; } foreach ( $db_templates as $template ) { if ( 'archive-product' === $template->slug ) { return $template; } } return false; }