Attribute Parser

The attribute parser converts a twig hash of key/value pairs into HTML formatted attributes to be inserted into HTML elements.

Example
{
  'class': 'my-class',
  'disabled': true,
}
/**
 * Convert an array of attributes into a HTML friendly string.
 *
 * @param  array  $attributes An array of attributes to parse
 * @param  array  $args       Arguments to affect the output:
 *                [exclude] A list of keys to remove. This takes precedence
 *                over other options
 *                [include] A list of keys to be output, all others will be
 *                ignored
 *                [default] Additional attributes to be included, if the
 *                attribute exists in both $attributes and $args, the values
 *                will be merged
 * @return string A space separated string of key="value" attributes ready
 *                for including in an HTML element
 */

results matching ""

    No results matching ""