Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection
NoResults::modify_anchor_tag_urls
Set the URL attributes for "clearing any filters" and "Store's home" links.
Method of the class: NoResults{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->modify_anchor_tag_urls( $content );
- $content(string) (required)
- Block content.
NoResults::modify_anchor_tag_urls() NoResults::modify anchor tag urls code WC 10.3.6
protected function modify_anchor_tag_urls( $content ) {
$processor = new \WP_HTML_Tag_Processor( trim( $content ) );
// Set the URL attribute for the "clear any filters" link.
if ( $processor->next_tag(
array(
'tag_name' => 'a',
'class_name' => 'wc-link-clear-any-filters',
)
) ) {
$processor->set_attribute( 'href', $this->get_current_url_without_filters() );
}
// Set the URL attribute for the "Store's home" link.
if ( $processor->next_tag(
array(
'tag_name' => 'a',
'class_name' => 'wc-link-stores-home',
)
) ) {
$processor->set_attribute( 'href', home_url() );
}
return $processor->get_updated_html();
}