MailPoet\EmailEditor\Integrations\Utils

Dom_Document_Helper::get_attribute_value_by_tag_name()publicWC 1.0

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.

Return

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() code WC 9.8.2

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 );
}