auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -8,31 +8,15 @@ namespace Automattic\WooCommerce\Blocks\Templates;
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
abstract class AbstractPageTemplate {
|
||||
/**
|
||||
* Page Template functionality is only initialized when using a block theme.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( wc_current_theme_is_fse_theme() ) {
|
||||
$this->init();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractPageTemplate extends AbstractTemplate {
|
||||
/**
|
||||
* Initialization method.
|
||||
*/
|
||||
protected function init() {
|
||||
public function init() {
|
||||
add_filter( 'page_template_hierarchy', array( $this, 'page_template_hierarchy' ), 1 );
|
||||
add_filter( 'pre_get_document_title', array( $this, 'page_template_title' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the template slug.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_slug();
|
||||
|
||||
/**
|
||||
* Returns the page object assigned to this template/page.
|
||||
*
|
||||
@@ -47,15 +31,6 @@ abstract class AbstractPageTemplate {
|
||||
*/
|
||||
abstract protected function is_active_template();
|
||||
|
||||
/**
|
||||
* Should return the title of the page, or an empty string if the page title should not be changed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_template_title() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* When the page should be displaying the template, add it to the hierarchy.
|
||||
*
|
||||
@@ -67,7 +42,7 @@ abstract class AbstractPageTemplate {
|
||||
*/
|
||||
public function page_template_hierarchy( $templates ) {
|
||||
if ( $this->is_active_template() ) {
|
||||
array_unshift( $templates, $this->get_slug() );
|
||||
array_unshift( $templates, static::SLUG );
|
||||
}
|
||||
return $templates;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user