Ejemplo n.º 1
0
 /**
  * Register the form builder instance.
  * @return void
  */
 protected function registerFormBuilder()
 {
     $this->app->bindShared('SleepingOwl\\Html\\FormBuilder', function ($app) {
         $htmlBuilder = $app->make('SleepingOwl\\Html\\HtmlBuilder');
         $form = new FormBuilder($htmlBuilder, $app['url'], $app['session.store']->getToken());
         return $form->setSessionStore($app['session.store']);
     });
 }
Ejemplo n.º 2
0
 /**
  * @param $route
  * @param $title
  * @param $label
  * @return string
  */
 protected function moveButton($route, $title, $label)
 {
     $content = '';
     $content .= $this->formBuilder->open(['method' => 'patch', 'url' => $route, 'class' => 'inline-block']);
     $content .= $this->htmlBuilder->tag('button', ['class' => 'btn btn-default btn-sm', 'type' => 'submit', 'data-toggle' => 'tooltip', 'title' => $title], $label);
     $content .= $this->formBuilder->close();
     return $content;
 }
Ejemplo n.º 3
0
 /**
  * @return string
  */
 public function render()
 {
     $content = [];
     $content[] = $this->formBuilder->model($this->instance, ['method' => $this->method, 'url' => $this->saveUrl, 'errors' => $this->errors]);
     foreach ($this->items as $item) {
         $content[] = $item->render();
     }
     $content[] = $this->formBuilder->submitGroup($this->backUrl);
     $content[] = $this->formBuilder->close();
     return implode('', $content);
 }
Ejemplo n.º 4
0
 /**
  * @return mixed
  */
 protected function getValueFromForm()
 {
     $value = $this->form->getValueForName($this->name);
     if (is_null($value) && !empty($this->form)) {
         $model = $this->form->instance;
         if (!is_null($model)) {
             $name = $this->name;
             $value = $model->{$name};
             $oldInput = $this->formBuilder->getSessionStore()->getOldInput($name);
             if (!is_null($oldInput)) {
                 $value = $oldInput;
             }
         }
     }
     return $value;
 }
Ejemplo n.º 5
0
 /**
  * @return string
  */
 public function renderInline()
 {
     $content = [];
     $id = uniqid();
     $content[] = $this->formBuilder->model($this->instance, ['method' => $this->method, 'url' => $this->saveUrl, 'errors' => $this->errors, 'class' => 'form-horizontal form-bordered', 'id' => $id, 'onsubmit' => 'return inlineFormSubmit(event, \'' . $id . '\');']);
     foreach ($this->inlineItems as $item) {
         if (method_exists($item, 'inlineEdit')) {
             $item->inlineEdit(true);
         }
         $content[] = $item->render();
     }
     if (count($this->inlineItems) == 1) {
         if ($this->inlineItems[0] instanceof Checkbox) {
         } else {
             $content[] = view('admin::model/inline_edit_form_controls')->with('inline_controls', true);
         }
     } else {
         $content[] = view('admin::model/inline_edit_form_controls')->with('inline_controls', false);
     }
     $content[] = $this->formBuilder->close();
     $response = implode('', $content);
     return $response;
 }