Exemplo n.º 1
0
 /**
  * @param Form $form
  * @return mixed
  */
 public function formOpen(Form $form)
 {
     $options = $form->getAttributes();
     $options['files'] = $form->files;
     if ($action = $form->action) {
         $options[$form->actionType] = $action;
     }
     if ($model = $form->model) {
         $html = $this->builder->model($model, $options);
         $form->fill(array_dot($model->toArray()));
     } else {
         $html = $this->builder->open($options);
     }
     return $html;
 }
Exemplo n.º 2
0
 /**
  * @param array $options
  * @return string
  */
 public function open(array $options = [])
 {
     $this->errors = array_get($options, 'errors');
     array_forget($options, 'errors');
     array_set($options, 'files', true);
     return parent::open($options);
 }
 /**
  * Open a form while passing a model and the routes for storing or updating 
  * the model. This will set the correct route along with the correct 
  * method.
  *
  * @param  array  $options
  * @return string
  */
 public function open(array $options = array())
 {
     $options = $this->parseModelBinding($options);
     // Set the HTML5 role.
     $options['role'] = 'form';
     // If the class hasn't been set, set the default style.
     if (!isset($options['class'])) {
         $defaultForm = $this->getDefaultForm();
         if ($defaultForm === 'horizontal') {
             $options['class'] = 'form-horizontal';
         } else {
             if ($defaultForm === 'inline') {
                 $options['class'] = 'form-inline';
             }
         }
     }
     return $this->form->open($options);
 }
 public function open(array $options = array())
 {
     if (!array_key_exists('autocomplete', $options)) {
         $options['autocomplete'] = 'off';
     }
     if (empty($options['role'])) {
         $options['role'] = 'form';
     }
     return parent::open($options);
 }
Exemplo n.º 5
0
 /**
  * Opens form, set rules
  *
  * @param array $rules 		Laravel validation rules
  *
  * @see Illuminate\Html\FormBuilder
  */
 public function open(array $options = array(), $rules = null)
 {
     $this->setValidation($rules);
     if (isset($options['name'])) {
         $this->converter->setFormName($options['name']);
     } else {
         $this->converter->setFormName(null);
     }
     return parent::open($options);
 }
Exemplo n.º 6
0
 /**
  * Open up a new HTML form.
  * Form model uses this so we dont have to check again
  *
  * @param  array   $options
  * @return string
  */
 public function open(array $options = array())
 {
     // Check if the user has access if not dont show the element
     if (!$this->checkRoleAccess($options)) {
         $this->access = false;
         return;
     } else {
         $this->access = true;
     }
     return parent::open($options);
 }
Exemplo n.º 7
0
 /**
  * Open up a new HTML form and includes a session key.
  * @param array $options
  * @return string
  */
 public function open(array $options = [])
 {
     $method = strtoupper(array_get($options, 'method', 'post'));
     $request = array_get($options, 'request');
     $model = array_get($options, 'model');
     if ($model) {
         $this->model = $model;
     }
     $append = $this->requestHandler($request);
     if ($method != 'GET') {
         $append .= $this->sessionKey(array_get($options, 'sessionKey'));
     }
     return parent::open($options) . $append;
 }
Exemplo n.º 8
0
 /**
  * Open the form, and add the fields for an specific action or the default fields if no action is defined.
  *
  * @param  string|null $action
  * @param  array       $attributes
  *
  * @return string
  */
 public function open($action = null, array $attributes = array())
 {
     if (is_array($action)) {
         $attributes = $action;
         $action = null;
     }
     $form = $this->formFor($action);
     $attributes = array_merge($attributes, ['method' => $this->method, 'url' => $this->action, 'files' => $this->hasFile()]);
     if ($this->model) {
         return $this->builder->model($this->model, $attributes);
     } else {
         return $this->builder->open($attributes);
     }
 }
Exemplo n.º 9
0
 /**
  * Open up a new HTML form.
  *
  * @param  array   $options
  * @return string
  */
 public function open(array $options = array())
 {
     if (isset($options['errors'])) {
         if (is_array($options['errors'])) {
             $this->setErrors($options['errors'][0]);
             if (isset($options['errors'][1])) {
                 $this->errorCssClass = $options['errors'][1];
             }
         } else {
             $this->setErrors($options['errors']);
         }
         unset($options['errors']);
     }
     return parent::open($options);
 }
Exemplo n.º 10
0
 /**
  * Overrides the base form open method to allow for automatic insertion of csrf tokens
  * and form class
  *
  * @param  array  $attributes
  * @return string
  */
 public function open(array $attributes = array())
 {
     // Add in the form class if necessary
     if (empty($attributes['class'])) {
         $attributes['class'] = $this->getOption('formClass');
     } elseif (strpos($attributes['class'], 'form-') === false) {
         $attributes['class'] .= ' ' . $this->getOption('formClass');
     }
     return parent::open($attributes);
 }
Exemplo n.º 11
0
 public function busqueda($params)
 {
     $this->buscando = true;
     return parent::open($params);
 }
Exemplo n.º 12
0
 public function open(array $options = array())
 {
     $default = ['files' => true];
     $options = array_merge($default, $options);
     return parent::open($options);
 }
Exemplo n.º 13
0
 /**
  * Open a form while passing a model and the routes for storing or updating
  * the model. This will set the correct route along with the correct
  * method.
  *
  * @param  array $options
  * @return string
  */
 public function open(array $options = [])
 {
     $this->translationDomain = array_get($options, 'translationDomain', '');
     unset($options['translationDomain']);
     return $this->form->open($options);
 }
Exemplo n.º 14
0
 /**
  * Open up a new HTML form.
  *
  * @param  array   $options
  * @return \Illuminate\Support\HtmlString
  */
 public function open(array $options = [])
 {
     return new HtmlString(parent::open($options));
 }
 /**
  * Opens form, set rules
  *
  * @param array $rules 		Laravel validation rules
  *
  * @see Illuminate\Html\FormBuilder
  */
 public function open(array $options = array(), $rules = null)
 {
     $this->setValidation($rules);
     return parent::open($options);
 }
Exemplo n.º 16
0
 /**
  * Open up a new HTML form.
  *
  * @param array $options
  * @return string 
  * @static 
  */
 public static function open($options = array())
 {
     return \Illuminate\Html\FormBuilder::open($options);
 }
Exemplo n.º 17
0
 public function open(array $options = array())
 {
     $defaults = array("role" => "form");
     $options = array_merge($defaults, $options);
     return parent::open($options);
 }