Exemplo n.º 1
0
 /**
  * @return string
  */
 public function render($sepparateByGroup = false)
 {
     $content = [];
     $content[] = $this->formBuilder->model($this->instance, ['method' => $this->method, 'url' => $this->saveUrl, 'errors' => $this->errors, 'class' => 'form-horizontal form-bordered']);
     $itemsCollection = [];
     if ($sepparateByGroup === true) {
         $content[] = '<div class="row">';
         foreach ($this->groups as $groupCode => $group) {
             $itemsCollection = [];
             foreach ($this->items as $item) {
                 if ($item->getGroup() == $groupCode) {
                     $itemsCollection[] = $item;
                 }
             }
             $content[] = view('admin::model/form_group')->with('items', $itemsCollection)->with('group', $group)->with('displayType', $group->getDisplayType());
         }
         $content[] = '</div>';
     } else {
         foreach ($this->items as $item) {
             $content[] = $item->render();
         }
     }
     $content[] = $this->formBuilder->submitGroup($this->backUrl, $sepparateByGroup);
     $content[] = $this->formBuilder->close();
     $response = implode('', $content);
     return $response;
 }
Exemplo n.º 2
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);
 }