HTMLEditorElementRule
class HTMLEditorElementRule (View source)
Rules used to define whether a given element or regex pattern of elements is allowed in the content of an HTMLEditorField.
Constants
| GLOBAL_NAME | Name of the global rule for a given rule set | 
Methods
Returns a HTMLEditorAttributeRule based on an associative array defining the rule.
No description
Returns true if the value returned from getName() is a regex pattern.
Get whether empty elements will have a non-breaking space added inside them.
Add an attribute rule which must apply to any elements covered by this element rule.
Remove an attribute rule so it no longer applies to any elements covered by this element rule.
Check whether the given DOM element is allowed according to this rule.
Check whether the give attribute is allowed for elements covered by this element rule.
Details
        
                static            HTMLEditorElementRule
    fromArray(string $name, array $ruleArray)
        
    
    Returns a HTMLEditorAttributeRule based on an associative array defining the rule.
If the rule array is empty, the defaults apply. Excludes attributes - get those separately using HTMLEditorAttributeRule::fromArray().
        
                            
    __construct(string $name, bool $nameIsPattern = false, bool $padEmpty = false, bool $removeIfEmpty = false, bool $removeIfNoAttributes = false)
        
    
    No description
        
                            string
    getName()
        
    
    Get the name of the element(s) this rule applies to.
This can also be a regex pattern - in which case getNameIsPattern() should return true.
        
                            bool
    getNameIsPattern()
        
    
    Returns true if the value returned from getName() is a regex pattern.
        
                            array
    getAttributeRules()
        
    
    Get all attribute rules
        
                            bool
    getPadEmpty()
        
    
    Get whether empty elements will have a non-breaking space added inside them.
        
                            bool
    getRemoveIfEmpty()
        
    
    Get whether empty elements will be removed.
        
                            bool
    getRemoveIfNoAttributes()
        
    
    Get whether elements with no attributes will be removed.
        
                            HTMLEditorElementRule
    setGlobalRule(HTMLEditorElementRule $rule)
        
    
    No description
        
                            HTMLEditorElementRule
    addAttributeRule(HTMLEditorAttributeRule $rule)
        
    
    Add an attribute rule which must apply to any elements covered by this element rule.
        
                            HTMLEditorElementRule
    removeAttributeRule(string $ruleName)
        
    
    Remove an attribute rule so it no longer applies to any elements covered by this element rule.
        
                            bool
    isElementAllowed(DOMElement $element)
        
    
    Check whether the given DOM element is allowed according to this rule.
Note that this method assumes this rule applies to the element - it does not check the tag name of the element as part of its conditional logic.
        
                            bool
    isAttributeAllowed(DOMAttr $attribute)
        
    
    Check whether the give attribute is allowed for elements covered by this element rule.