protected function _getLabelAttr(Element $element, $attr = array()) { if (isset($attr['container'])) { return $this->_mergeAttributes(array($this->defaulLabelAttributes, $element->getLabelAttributes())); } return $this->defaulLabelAttributes; }
/** * Get the proper class for the label depending on the element type. * NOTE: This returns all the attributes for the element, not just the class * * @param Element $element * @return array */ public function setLabelClasses(Element $element) { $labelAttributes = $element->getLabelAttributes(); $controlClass = ''; //If the class attribute is not set, set an empty one to avoid errors later if (!isset($labelAttributes['class'])) { $labelAttributes['class'] = ''; } //Radio elements are special. The group of elements can have a control label & each individual element can have //it's own label. So we set the control label here and use if ($this->isControl($element) || $this->isRadio($element)) { $controlClass = strstr($labelAttributes['class'], 'control-label') === false ? ' control-label' : ''; } elseif ($this->isCheckbox($element)) { $controlClass = strstr($labelAttributes['class'], 'checkbox') === false ? ' checkbox' : ''; } //Hidden elements don't have special classes in Bootstrap so no need to check for them $labelAttributes['class'] = trim($labelAttributes['class'] . $controlClass); return $labelAttributes; }
public function testLabelAttributesAreEmptyByDefault() { $element = new Element(); $this->assertEquals(array(), $element->getLabelAttributes()); }