HtmlAugmenter
class HtmlAugmenter (View source)
A tool that can augment HTML for example by adding arbitrary attributes.
This is used in order to add meta data arguments to content elements in the Backend.
Usage:
$html = '
// will return '
Methods
Adds the given $attributes to the $html by augmenting the root element.
Detects a unique root tag in the given $html string and returns its DOMNode representation - or NULL if no unique root element could be found
Merges the attributes of $element with the given $newAttributes
If an attribute exists in both collections, it is merged to "
Renders the given key/value pair to a valid attribute string in the format 
Checks whether the given $element contains at least one of the specified $attributes (case insensitive)
Details
        
                            string
    addAttributes(string $html, array $attributes, string $fallbackTagName = 'div', array $exclusiveAttributes = null)
        
    
    Adds the given $attributes to the $html by augmenting the root element.
Attributes are merged with the existing root element's attributes. If no unique root node can be determined, a wrapping tag is added with all the given attributes. The name of this tag can be specified with $fallbackTagName.
        
                    protected        DOMNode
    getHtmlRootElement(string $html)
        
    
    Detects a unique root tag in the given $html string and returns its DOMNode representation - or NULL if no unique root element could be found
        
                    protected        void
    mergeAttributes(DOMNode $element, array $newAttributes)
        
    
    Merges the attributes of $element with the given $newAttributes
If an attribute exists in both collections, it is merged to "
        
                    protected        string
    renderAttributes(array $attributes)
        
    
    Renders the given key/value pair to a valid attribute string in the format 
..
        
                    protected        bool
    elementHasAttributes(DOMNode $element, array $attributes = null)
        
    
    Checks whether the given $element contains at least one of the specified $attributes (case insensitive)