Add custom class to attribute render
Permalink
Hi,
Working with attributes in a new website and I want to add some custom classes to the "render" method of each attribute. Also other options would be nice, just like the form-helper, but for now the class will suffice.
For example:
will return
I need to return something like this:
For now I changed the AttributeType Model to:
This works great for the label, but I want it to work for any element I render.
Can someone point me in the right direction?
Working with attributes in a new website and I want to add some custom classes to the "render" method of each attribute. Also other options would be nice, just like the form-helper, but for now the class will suffice.
For example:
$ak->render('label')
will return
<label for="akID[34][value]" class="control-label">Address</label>
I need to return something like this:
<label for="akID[34][value]" class="col-sm-3 control-label">Address</label>
For now I changed the AttributeType Model to:
class AttributeType extends Concrete5_Model_AttributeType { public function render($view, $ak = false, $value = false, $return = false) { if ($view == 'label' && $ak) { $label = $this->label($ak, $value); if ($return) { return $label; } } else { Loader::library('attribute/view'); $av = new AttributeTypeView($this, $ak, $value); $resp = $av->render($view, $return); if ($return) { return $resp; } }
Viewing 15 lines of 24 lines. View entire code block.
This works great for the label, but I want it to work for any element I render.
Can someone point me in the right direction?