예제 #1
0
 /**
  * Add a multifield to the Area
  *
  * @param string $label The multifield's label
  * @param array $meta The standard meta array
  * @return \ValidFormBuilder\MultiField
  */
 public function addMultiField($label = null, $meta = array())
 {
     if (!array_key_exists("dynamic", $meta)) {
         $meta["dynamic"] = $this->__dynamic;
     }
     // *** Overwrite dynamic settings. We cannot have a dynamic multifield inside a dynamic area.
     if ($this->__dynamic) {
         $meta["dynamic"] = $this->__dynamic;
         $meta["dynamicLabel"] = "";
     }
     $objField = new MultiField($label, $meta);
     $objField->setRequiredStyle($this->__requiredstyle);
     $objField->setMeta("parent", $this, true);
     $this->__fields->addObject($objField);
     return $objField;
 }
예제 #2
0
 /**
  * Add multifield
  *
  * See {@link \ValidFormBuilder\ValidForm::addMultiField()}
  *
  * @see \ValidFormBuilder\ValidForm::addMultiField()
  */
 public function addMultiField($label = null, $meta = array())
 {
     $objField = new MultiField($label, $meta);
     $objField->setRequiredStyle($this->__requiredstyle);
     // *** Page already defined?
     $objPage = $this->__elements->getLast("ValidFormBuilder\\Page");
     if ($this->__elements->count() == 0 || !is_object($objPage)) {
         $objPage = $this->addPage();
     }
     // *** Fieldset already defined?
     $objFieldset = $objPage->getElements()->getLast("ValidFormBuilder\\Fieldset");
     if ($this->__elements->count() == 0 || !is_object($objFieldset)) {
         $objFieldset = $this->addFieldset();
     }
     $objField->setMeta("parent", $objFieldset, true);
     // *** Add field to the fieldset.
     $objFieldset->addField($objField);
     return $objField;
 }