Submit
Path:
~
/
home
/
getwphos
/
public_html
/
perfumehousedhaka
/
wp-content
/
plugins
/
woocommerce
/
src
/
Blocks
/
Templates
/
File Content:
AbstractTemplateWithFallback.php
<?php declare( strict_types=1 ); namespace Automattic\WooCommerce\Blocks\Templates; use Automattic\WooCommerce\Blocks\Utils\BlockTemplateUtils; /** * AbstractTemplateWithFallback class. * * Shared logic for templates with fallbacks. * * @internal */ abstract class AbstractTemplateWithFallback extends AbstractTemplate { /** * The fallback template to render if the existing template is not available. * * @var string */ public string $fallback_template; /** * Initialization method. */ public function init() { add_filter( 'taxonomy_template_hierarchy', array( $this, 'template_hierarchy' ), 1 ); add_action( 'template_redirect', array( $this, 'render_block_template' ) ); } /** * Add the fallback template to the hierarchy, right after the current template. * * @param array $templates Templates that match the taxonomy_template_hierarchy. */ 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; } /** * This method is hooked to WordPress' 'template_redirect' action and allows * template classes to: * 1. Decide when block templates should be rendered based on the context. * 2. Execute specific logic, such as managing the compatibility layer for * legacy template support. * * Child classes must implement this method to define their template * rendering conditions and any additional template-specific behavior. */ abstract public function render_block_template(); }
Submit
FILE
FOLDER
Name
Size
Permission
Action
AbstractPageTemplate.php
1855 bytes
0644
AbstractTemplate.php
737 bytes
0644
AbstractTemplateCompatibility.php
5894 bytes
0644
AbstractTemplatePart.php
332 bytes
0644
AbstractTemplateWithFallback.php
1843 bytes
0644
ArchiveProductTemplatesCompatibility.php
12726 bytes
0644
CartTemplate.php
2008 bytes
0644
CheckoutHeaderTemplate.php
863 bytes
0644
CheckoutTemplate.php
2047 bytes
0644
ClassicTemplatesCompatibility.php
2430 bytes
0644
ComingSoonSocialLinksTemplate.php
1132 bytes
0644
ComingSoonTemplate.php
2642 bytes
0644
ExternalProductAddToCartWithOptionsTemplate.php
1021 bytes
0644
GroupedProductAddToCartWithOptionsTemplate.php
1016 bytes
0644
MiniCartTemplate.php
1714 bytes
0644
OrderConfirmationTemplate.php
1618 bytes
0644
ProductAttributeTemplate.php
2756 bytes
0644
ProductBrandTemplate.php
1777 bytes
0644
ProductCatalogTemplate.php
2316 bytes
0644
ProductCategoryTemplate.php
1783 bytes
0644
ProductSearchResultsTemplate.php
2068 bytes
0644
ProductTagTemplate.php
1763 bytes
0644
SimpleProductAddToCartWithOptionsTemplate.php
1011 bytes
0644
SingleProductTemplate.php
9253 bytes
0644
SingleProductTemplateCompatibility.php
14774 bytes
0644
VariableProductAddToCartWithOptionsTemplate.php
1021 bytes
0644
N4ST4R_ID | Naxtarrr