AMP_Base_Sanitizer::add_or_append_attribute( string[] $attributes, string $key, string $value, string $separator = ' ' )
Description #
Adds or appends key and value to list of attributes
Adds key and value to list of attributes, or if the key already exists in the array it concatenates to existing attribute separator by a space or other supplied separator.
Parameters #
- $attributes
-
(Required) { Attributes. @type int $height @type int $width @type string $sizes @type string $class @type string $layout }
- $key
-
(Required) Valid associative array index to add.
- $value
-
(Required) Value to add or append to array indexed at the key.
- $separator
-
(Optional) defaults to space but some other separator if needed.
Default value:' '