Bootstrapper\Form::label PHP Method

label() public method

public label ( string $name, string | null $value = null, array $options = [], $escape_html = true ) : string
$name string The name of the object this label will be attached to
$value string | null The text of the label
$options array The options of the label
return string
    public function label($name, $value = null, $options = array(), $escape_html = true)
    {
        $options['class'] = isset($options['class']) ? self::LABEL . ' ' . $options['class'] : self::LABEL;
        return parent::label($name, $value, $options, $escape_html);
    }

Usage Example

Example #1
0
 function it_can_be_given_contents_as_an_array(Form $form)
 {
     $form->label('first', 'First')->willReturn('label1');
     $form->checkbox('first', 'First')->willReturn('checkbox1');
     $form->label('second', 'Second')->willReturn('label2');
     $form->checkbox('second', 'Second')->willReturn('checkbox2');
     $this->withContents([['label' => ['first', 'First'], 'input' => ['type' => 'checkbox', 'first', 'First']], ['label' => ['second', 'Second'], 'input' => ['type' => 'checkbox', 'second', 'Second']]])->render()->shouldBe("<div class='form-group'>label1 checkbox1<br />label2 checkbox2<br /></div>");
 }
All Usage Examples Of Bootstrapper\Form::label