Modules attributes
A part of this package is to allow non html related attributes, which indicate how bootstrap elements should be rendered.
For example, the Html_Button
is like a Html::anchor
with extra attributes, like status
, size
.
Those attributes are registered in module's config files, with expected values, under the attributes
key. All of those registered attributes are cleaned before rendering the html, and css classes are merged with bootstrap generated ones.
String attributes
Attributes are provided throught an array like ['id' => 'myelement', 'status' => 'primary', ..etc]
, but the package, throught config files, allow you to specify a default attribute, which be used as key if the $attribute
parameter is a string.
Html::button('#', 'My button', array('status' => 'inverse'))My button
attribute
key is set to status
, which means third param string will be interpreted as status:
Html::button('#', 'My button', 'inverse')
Youn can set any attribute you want, including classic HTML attribute.
Only valid attributes are accepted
If you provide a "bootstrap" attribute, make sure the string is a registered value in you config file:
Html::button('#', 'My button', array('status' => 'unknown'))
Throw an InvalidArgumentException
Those values are based on Twitter Bootstrap defaults, fell free to add your own, but take a look in modules to learn how markups are generated from them.