Automattic\WooCommerce\EmailEditor\Integrations\Utils
Dom_Document_Helper::get_attribute_value_by_tag_name
Searches for the first appearance of the given tag name and returns the value of specified attribute.
Method of the class: Dom_Document_Helper{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Dom_Document_Helper = new Dom_Document_Helper(); $Dom_Document_Helper->get_attribute_value_by_tag_name( $tag_name, $attribute ): ?string;
- $tag_name(string) (required)
- The tag name to search for.
- $attribute(string) (required)
- The attribute to get the value from.
Dom_Document_Helper::get_attribute_value_by_tag_name() Dom Document Helper::get attribute value by tag name code WC 10.5.0
public function get_attribute_value_by_tag_name( string $tag_name, string $attribute ): ?string {
$element = $this->find_element( $tag_name );
if ( ! $element ) {
return null;
}
return $this->get_attribute_value( $element, $attribute );
}