Example #1
0
 /**
  * Add a form field
  * @param $label     Field Label
  * @param $object    Field Object
  * @param $size      Field Size
  */
 public function addField($label, FormElementInterface $object, $size = 200)
 {
     $object->setSize($size, $size);
     $this->fields[$object->getName()] = $object;
     $object->setLabel($label);
     // adiciona linha
     $row = $this->table->addRow();
     $label_field = new Label($label);
     if ($object instanceof Hidden) {
         $row->addCell('');
     } else {
         $row->addCell($label_field);
     }
     $row->addCell($object);
     return $row;
 }
Example #2
0
File: Form.php Project: itav/form
 /**
  * @param FormElementInterface $element
  * @param string $index
  * @return $this
  */
 public function addElement($element, $index = null)
 {
     //Add form to form
     if ($element instanceof Form) {
         foreach ($element->getElements() as $key => $element) {
             if (!array_key_exists($key, $this->elements)) {
                 $this->elements[$key] = $element;
             }
             $this->elements[] = $element;
         }
         return $this;
     }
     if ($index) {
         $this->elements[$index] = $element;
         return $this;
     }
     $this->elements[] = $element;
     return $this;
 }