Function generateAttributesFromArray
Helper to generate attributename="attributevalue" for HTML elements based on an array consisting of key => value pairs
Returns a string with with prependend space to directly use with an HTML element.
Note: There is no check if these attributes are valid. Also values are not html_encoded as that could break for example JS event handlers. Do this in your attribute definition array as needed. Attributes with an empty value are skipped except the alt attribute or known boolean attributes (see in function definition)
array |
$attributes = array() |
key => value pairs of element attribute name and value. e.g. array('class' => 'someclass', 'id' => 'someid'); |
array |
$exclude = array() |
Names of attributes to exclude (in case already set otherwise) |
string
|
string |