本文整理匯總了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());
}