Automattic\WooCommerce\Blocks\Templates
AbstractTemplateWithFallback::template_hierarchy
Add the fallback template to the hierarchy, right after the current template.
Метод класса: AbstractTemplateWithFallback{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$AbstractTemplateWithFallback = new AbstractTemplateWithFallback(); $AbstractTemplateWithFallback->template_hierarchy( $templates );
- $templates(массив) (обязательный)
- Templates that match the taxonomy_template_hierarchy.
Код AbstractTemplateWithFallback::template_hierarchy() AbstractTemplateWithFallback::template hierarchy WC 10.3.6
public function template_hierarchy( $templates ) {
$index = array_search( static::SLUG, $templates, true );
if ( false === $index ) {
$index = array_search( static::SLUG . '.php', $templates, true );
}
if (
false !== $index && (
! array_key_exists( $index + 1, $templates ) || $templates[ $index + 1 ] !== $this->fallback_template
) ) {
array_splice( $templates, $index + 1, 0, $this->fallback_template );
}
return $templates;
}