/** * Adds a label to the group/field * * @param string $text A label * @param array $attributes The label's attributes * * @return Field A field */ public function label($text, $attributes = array()) { // Create the Label element $for = $this->id ?: $this->name; $label = $this->app['former']->label($text, $for, $attributes); // Set label $this->label = $label; if ($this->group) { $this->group->setLabel($label); } return $this; }