本文整理汇总了PHP中Zend\Form\Element::getLabelAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::getLabelAttributes方法的具体用法?PHP Element::getLabelAttributes怎么用?PHP Element::getLabelAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element
的用法示例。
在下文中一共展示了Element::getLabelAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getLabelAttr
protected function _getLabelAttr(Element $element, $attr = array())
{
if (isset($attr['container'])) {
return $this->_mergeAttributes(array($this->defaulLabelAttributes, $element->getLabelAttributes()));
}
return $this->defaulLabelAttributes;
}
示例2: setLabelClasses
/**
* 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;
}
示例3: testLabelAttributesAreEmptyByDefault
public function testLabelAttributesAreEmptyByDefault()
{
$element = new Element();
$this->assertEquals(array(), $element->getLabelAttributes());
}