Ejemplo n.º 1
0
 /**
  * Factory mehtod to create new FormElement object within this group object.
  *
  * @param string $type
  *            Elementtype to create
  * @param string|AbstractForm|AbstractHtml|FormGroup $content
  *            Content of the element to create
  * @param bool $unshift
  *            Optional boolean flag to add element on top of elements stack of this group
  *
  * @return \Core\Html\FormDesigner\FormElement
  */
 private function elementFactory($type, $content, $unshift = false)
 {
     $element = $this->factory->create('FormDesigner\\FormElement');
     $element->setContent($content);
     if ($unshift == true) {
         array_unshift($this->elements, $element);
     } else {
         $this->elements[] = $element;
     }
     return $element;
 }
Ejemplo n.º 2
0
 /**
  * Creates a FormGroup
  *
  * @param bool $unshift
  *            Optional flag to add group at beginning of controls array.
  *
  * @return FormGroup
  */
 public function &addGroup($unshift = false)
 {
     $group = $this->factory->create('FormDesigner\\FormGroup');
     if ($unshift == true) {
         array_unshift($this->groups, $group);
     } else {
         $this->groups[] = $group;
     }
     $group->injectFormDesigner($this);
     return $group;
 }