Pop\Form\Element::setLabelAttributes PHP Method

setLabelAttributes() public method

Set the attributes of the label of the form element object.
public setLabelAttributes ( array $attribs ) : Element
$attribs array
return Element
    public function setLabelAttributes(array $attribs)
    {
        foreach ($attribs as $a => $v) {
            $this->labelAttributes[$a] = $v;
        }
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 public function testSetAndGetLabelAttributes()
 {
     $e = new Element('text', 'email');
     $e->setLabel('Email:');
     $e->setLabelAttributes(array('class' => 'label-class'));
     $attribs = $e->getLabelAttributes();
     $this->assertEquals('label-class', $attribs['class']);
 }