Asset.styleAttr ViewHelper <f:asset.styleAttr> 

ViewHelper for inline style attributes that need CSP hash coverage via style-src-attr.

When csp is true (default), the style value is hashed and registered with the HashCollection so that the CSP header includes the corresponding sha256-... hash.

Usage:

   <div style="{f:asset.styleAttr(value: 'color: green; text-decoration: underline;', csp: true)}">...</div>
Copied!

Go to the source code of this ViewHelper: Asset\StyleAttrViewHelper.php (GitHub).

Arguments

The following arguments are available for the asset.styleAttr ViewHelper:

csp

csp
Type
bool
Default
true
Whether to collect a CSP hash for this style value

value

value
Type
string
Required
1
The inline style value (e.g. "color: green; text-decoration: underline;")