Пример #1
0
 /**
  * an element to add to the form
  * @param Element $element
  * @throws BuilderException
  * @return $this;
  */
 public function add(Element $element)
 {
     if (!$this->currentGroup) {
         throw new BuilderException("Call to add() impossible, no group opened," . "you probably didn't open a group or you closed to many groups");
     }
     $this->currentGroup->addElement($element);
     $this->lastElement = $element;
     return $this;
 }
Пример #2
0
 /**
  * an element to add to the form
  * @param Element $element
  * @throws BuilderException
  * @return $this;
  */
 public function add(Element $element)
 {
     if (!$this->currentGroup) {
         throw new BuilderException('Call to add() impossible, no group opened,' . "you probably didn't open a group or you closed to many groups");
     }
     $this->currentGroup->addElement($element);
     $this->lastElement = $element;
     if ($element instanceof Element\Validatable) {
         $element->addValidator(new IsValid());
     }
     return $this;
 }
Пример #3
0
 /**
  * @inheritdoc
  */
 public function setParent(Container $parent)
 {
     if (!$parent instanceof ColumnGroup) {
         throw new Exception("The column parent must be a column group");
     }
     return parent::setParent($parent);
 }
Пример #4
0
 public function addElement(Element $element)
 {
     if (!$element instanceof Tab) {
         throw new InvalidArgumentException("element", "Instance of Tab", $element, "Cannot add non-tab element into TabGroup");
     }
     parent::addElement($element);
 }
Пример #5
0
 /**
  * Adds a column to the group. Column can only receive column as child.
  * @param Element $element
  */
 public function addElement(Element $element)
 {
     if (!$element instanceof Column) {
         throw new InvalidArgumentException("element", "Instance of Column", $element, "Cant add non-column element into columnGroup");
     }
     parent::addElement($element);
 }
Пример #6
0
 /**
  * @param string $action form action
  * @param string $method form method
  */
 public function __construct($action = null, $method = null)
 {
     $this->form = $this;
     parent::__construct();
     $this->addSemanticType('form');
     if ($action) {
         $this->setAction($action);
     }
     if ($method) {
         $this->setMethod($method);
     } else {
         $this->setMethod(self::METHOD_POST);
     }
 }
Пример #7
0
 /**
  *
  * @param string $name name of the checkbox. Just type "name" and it will generate some "name[]"
  * @param array $values list of checkboxes to create
  * @throws \UForm\Exception
  */
 public function __construct($name, $values)
 {
     $elements = [];
     $i = 0;
     foreach ($values as $k => $v) {
         if (is_string($v) || is_int($v)) {
             $elements[] = new Check($k, $v);
         } else {
             throw new Exception("Invalid type for checkgroup creation");
         }
         $i++;
     }
     parent::__construct($name, $elements);
     $this->addSemanticType("checkGroup");
 }
Пример #8
0
 public function prepareFilterChain(FilterChain $filterChain)
 {
     parent::prepareFilterChain($filterChain);
     $filterChain->addFiltersFor($this->getProxyName(true), $this->getFilters());
 }
Пример #9
0
 public function __construct($title = null, $name = null, $elements = [])
 {
     parent::__construct($name, $elements);
     $this->setOption("title", $title);
     $this->addSemanticType("namedGroup");
 }
Пример #10
0
 public function __construct()
 {
     parent::__construct(null);
     $this->addSemanticType('structuralGroup');
 }
Пример #11
0
 public function __construct($name = null, $elements = null)
 {
     parent::__construct($name, $elements);
     $this->addSemanticType("row");
 }