/** * Render a disabled field * * @param Field $field * * @return Input */ public function createDisabledField(Field $field) { $field->disabled(); return Input::create('text', $field->getName(), $field->getValue(), $field->getAttributes()); }
/** * Create a label for a field * * @param Field $field * @param Element $label The field label if non provided * * @return string A label */ public function createLabelOf(Field $field, Element $label = null) { // Get the label and its informations if (!$label) { $label = $field->getLabel(); } // Get label "for" $for = $field->id ?: $field->getName(); // Get label text $text = $label->getValue(); if (!$text) { return false; } // Append required text if ($field->isRequired()) { $text .= $this->app['form']->getOption('required_text'); } // Render plain label if checkable, else a classic one $label->setValue($text); if (!$field->isCheckable()) { $label->for($for); } return $label; }