Esempio n. 1
0
 /**
  * Return an element by name
  * @param string $name
  * @return \Zbase\Ui\Form\ElementInterface
  */
 public function element($name)
 {
     $this->prepare();
     if (!empty($this->_elements)) {
         foreach ($this->_elements as $i => $element) {
             if ($element instanceof Form) {
                 $formE = $element->element($name);
                 if ($formE instanceof \Zbase\Ui\Form\ElementInterface) {
                     return $formE;
                 }
             }
             if ($name == $element->name()) {
                 return $element;
             }
         }
     }
     if (!empty($this->_tabs)) {
         $tabs = $this->_tabs->tabs();
         if (!empty($tabs)) {
             foreach ($tabs as $tab) {
                 $elements = $tab->getContents();
                 if (!empty($elements)) {
                     foreach ($elements as $element) {
                         if ($name == $element->name()) {
                             return $element;
                         }
                     }
                 }
             }
         }
     }
     return null;
 }
Esempio n. 2
0
 /**
  *
  * @param string|UIs\Tabs $group
  * @return UIs\Tab
  */
 public function setGroup($group)
 {
     $groupId = $group instanceof UIs\Tabs ? $group->id() : $group;
     $this->_group = zbase()->ui()->tabs()->get($groupId, true)->add($this);
     return $this;
 }