Пример #1
0
 /** Add element to the list
  * @param \System\Form\Element $el
  * @return void;
  */
 public function &add_element(\System\Form\Element $el)
 {
     $el->form($this->form());
     $fits = false;
     foreach ($this->get_expected_class() as $cname) {
         if ($el instanceof $cname) {
             $fits = true;
             break;
         }
     }
     if ($fits) {
         $this->elements[$el->name] = $el;
     } else {
         throw new \System\Error\Form(sprintf('Form container %s cannot accomodate element of type %s', $this->type, get_class($el)));
     }
     return $el;
 }