Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 502 Bytes

label.md

File metadata and controls

33 lines (24 loc) · 502 Bytes

Label Field Part

Represents label for a form field. If label is empty, field part will be hidden.

Usage Example

Form model:

final class CreateForm extends FormModel
{
    public ?string $name = null;

    public function getAttributeLabels(): array
    {
        return [
            'name' => 'Full Name',
        ];
    }
}

Widget:

echo Label::widget()->formAttribute($createForm, 'name');

Result will be:

<label for="createform-name">Full Name</label>