Automattic\WooCommerce\Blocks\BlockTypes
ProductFilterTaxonomy::enqueue_data
Extra data passed through from server to client for block.
Method of the class: ProductFilterTaxonomy{}
Hooks from the method
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->enqueue_data( $attributes );
- $attributes(array)
- Any attributes that currently are available from the block. Note, this will be empty in the editor context when the block is not in the post content on editor load.
Default:array()
ProductFilterTaxonomy::enqueue_data() ProductFilterTaxonomy::enqueue data code WC 10.7.0
protected function enqueue_data( array $attributes = array() ) {
parent::enqueue_data( $attributes );
if ( is_admin() ) {
$this->asset_data_registry->add( 'filterableProductTaxonomies', $this->get_taxonomies() );
// Expose sortable taxonomies so the editor can show/hide "Menu order" option.
$this->asset_data_registry->add(
'sortableTaxonomies',
/**
* Filters the list of taxonomies that support custom ordering. Filter was introduced long
* ago is only documented in 10.6.0.
*
* First instance in plugins/woocommerce/includes/admin/class-wc-admin-assets.php.
*
* @since 1.0
*
* @param array $sortable_taxonomies List of taxonomy slugs that support custom ordering.
* @return array List of taxonomy slugs that support custom ordering.
*/
apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) )
);
}
}