AttributesHTML
trait AttributesHTML (View source)
This trait can be applied to a ViewableData class to add the logic to render attributes in an SS template.
When applying this trait to a class, you also need to add the following casting configuration.
private static $casting = [
    'AttributesHTML' => 'HTMLFragment',
    'getAttributesHTML' => 'HTMLFragment',
];        Properties
| protected | array | $attributes | List of attributes to render on the frontend  | 
                
Methods
Allows customization through an 'updateAttributes' hook on the base class.
Custom attributes to process. Falls back to getAttributes().
Details
        
                            $this
    setAttribute($name, $value)
        
    
    Set an HTML attribute
        
                            mixed|null
    getAttribute(string $name)
        
    
    Retrieve the value of an HTML attribute
        
            abstract        protected        array
    getDefaultAttributes()
        
    
    Get the default attributes when rendering this object.
Called by getAttributes()
        
                            array
    getAttributes()
        
    
    Allows customization through an 'updateAttributes' hook on the base class.
Existing attributes are passed in as the first argument and can be manipulated, but any attributes added through a subclass implementation won't be included.
        
                            string
    getAttributesHTML(array $attributes = null)
        
    
    Custom attributes to process. Falls back to getAttributes().
If at least one argument is passed as a string, all arguments act as excludes, by name.