Example #1
0
 /**
  * (non-PHPdoc)
  *
  * @see \Core\Html\AbstractHtml::build()
  *
  * @throws FormDesignerException
  */
 public function build()
 {
     if (empty($this->groups)) {
         throw new FormDesignerException('Your form has no groups to show. Add groups and try again.');
     }
     if (!$this->html->getId()) {
         throw new FormDesignerException('There is no unique form id set. Each FormDesigner form needs it\'s unique id');
     }
     // Handle global container errors
     $this->handleGlobalContainerErrors();
     // Handle display mode
     $this->handleDisplayMode();
     // Control html container
     $html = '';
     // Create hidden field with unique session token
     if (!empty($this->token)) {
         $html .= '<input type="hidden" name="' . $this->token['name'] . '" value="' . $this->token['token'] . '">';
     }
     foreach ($this->groups as $group) {
         $html .= $this->buildGroup($group, [], $this->data, $this->errors);
     }
     $this->html->addInner($html);
     return $this->html->build();
 }