Example #1
0
 /**
  * Get the field id
  *
  * @param  InputInterface $field
  * @param  array          $attributes
  *
  * @return string
  */
 public function getFieldId(InputInterface $field, array $attributes = array())
 {
     $name = $field->getName();
     $field_attributes = $field->getAttributes();
     $id = trim(preg_replace('/[^a-z-]/', '-', "{$this->namespace}-{$name}"), '-');
     return array_get($attributes, 'id', array_get($field_attributes, 'id', $id));
 }
Example #2
0
 /**
  * Add a single field to the collection.
  *
  * @param  $input Ruysu\LaravelForm\FormBuilder\Inputs\InputInterface
  *
  * @return Ruysu\LaravelForm\FormBuilder
  */
 public function add(InputInterface $input)
 {
     $name = $input->getName();
     $this->fields->put($name, $input);
     return $this;
 }