Submit
Path:
~
/
home
/
getwphos
/
public_html
/
almajd14
/
wp-content
/
plugins
/
woocommerce
/
src
/
Blocks
/
Templates
/
File Content:
ClassicTemplatesCompatibility.php
<?php namespace Automattic\WooCommerce\Blocks\Templates; use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry; /** * ClassicTemplatesCompatibility class. * * To bridge the gap on compatibility with widget blocks and classic PHP core templates. * * @internal */ class ClassicTemplatesCompatibility { /** * Instance of the asset data registry. * * @var AssetDataRegistry */ protected $asset_data_registry; /** * Constructor. * * @param AssetDataRegistry $asset_data_registry Instance of the asset data registry. */ public function __construct( AssetDataRegistry $asset_data_registry ) { $this->asset_data_registry = $asset_data_registry; $this->init(); } /** * Initialization method. */ protected function init() { // phpcs:ignore WooCommerce.Functions.InternalInjectionMethod.MissingPublic if ( ! wp_is_block_theme() ) { add_action( 'template_redirect', array( $this, 'set_classic_template_data' ) ); // We need to set this data on the widgets screen so the filters render previews. add_action( 'load-widgets.php', array( $this, 'set_filterable_product_data' ) ); } } /** * Executes the methods which set the necessary data needed for filter blocks to work correctly as widgets in Classic templates. * * @return void */ public function set_classic_template_data() { $this->set_filterable_product_data(); $this->set_php_template_data(); } /** * This method passes the value `has_filterable_products` to the front-end for product archive pages, * so that widget product filter blocks are aware of the context they are in and can render accordingly. * * @return void */ public function set_filterable_product_data() { global $pagenow; if ( is_shop() || is_product_taxonomy() || 'widgets.php' === $pagenow ) { $this->asset_data_registry->add( 'hasFilterableProducts', true ); } } /** * This method passes the value `is_rendering_php_template` to the front-end of Classic themes, * so that widget product filter blocks are aware of how to filter the products. * * This data only matters on WooCommerce product archive pages. * On non-archive pages the merchant could be using the All Products block which is not a PHP template. * * @return void */ public function set_php_template_data() { if ( is_shop() || is_product_taxonomy() ) { $this->asset_data_registry->add( 'isRenderingPhpTemplate', true ); } } }
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
1441 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
2770 bytes
0644
ProductBrandTemplate.php
1791 bytes
0644
ProductCatalogTemplate.php
2330 bytes
0644
ProductCategoryTemplate.php
1797 bytes
0644
ProductSearchResultsTemplate.php
2082 bytes
0644
ProductTagTemplate.php
1777 bytes
0644
SimpleProductAddToCartWithOptionsTemplate.php
1011 bytes
0644
SingleProductTemplate.php
9408 bytes
0644
SingleProductTemplateCompatibility.php
14774 bytes
0644
VariableProductAddToCartWithOptionsTemplate.php
1021 bytes
0644
N4ST4R_ID | Naxtarrr