/** * 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; }
/** * 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; }
/** * @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); }
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); }
/** * 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); }
/** * @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); } }
/** * * @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"); }
public function prepareFilterChain(FilterChain $filterChain) { parent::prepareFilterChain($filterChain); $filterChain->addFiltersFor($this->getProxyName(true), $this->getFilters()); }
public function __construct($title = null, $name = null, $elements = []) { parent::__construct($name, $elements); $this->setOption("title", $title); $this->addSemanticType("namedGroup"); }
public function __construct() { parent::__construct(null); $this->addSemanticType('structuralGroup'); }
public function __construct($name = null, $elements = null) { parent::__construct($name, $elements); $this->addSemanticType("row"); }