Пример #1
0
 /**
  * Add a button to the navigation object
  *
  * @param string $label Button label
  * @param array $meta The meta array
  * @return \ValidFormBuilder\Button
  */
 public function addButton($label, $meta = array())
 {
     $objButton = new Button($label, $meta);
     // *** Set the parent for the new field.
     $objButton->setMeta("parent", $this, true);
     $this->__fields->addObject($objButton);
     return $objButton;
 }
Пример #2
0
 /**
  * Adds a <button> element to the internal fields collection.
  *
  * For an example; see {@link \ValidFormBuilder\Button}
  *
  * @param string $strLabel The button's label
  * @param array $arrMeta The meta array
  * @return \ValidFormBuilder\Button
  */
 public function addButton($strLabel, $arrMeta = array())
 {
     $objButton = new Button($strLabel, $arrMeta);
     // *** Fieldset already defined?
     $objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
     if ($this->__elements->count() == 0 || !is_object($objFieldset)) {
         $objFieldset = $this->addFieldset();
     }
     $objButton->setMeta("parent", $objFieldset, true);
     // *** Add field to the fieldset.
     $objFieldset->addField($objButton);
     return $objButton;
 }