Exemple #1
0
 /**
  * Append html to the form.
  *
  * @param   Brick|string  $html       (Html) element to append.
  * @param   Brick         $container  Container to add the element to first.
  * @return  self
  */
 public function append($field, $container = null)
 {
     // Try to retrieve the input name
     $name = null;
     if ($field instanceof Brick) {
         $name = $field->attr('name');
     }
     // Determine the parent container of the field
     $parent = null;
     if ($container !== $this) {
         $parent = $container;
     }
     // Allow the user to provide an inline message for each invalid field
     if ($name && $this->messages->has($name)) {
         $this->trigger('error', array($field, $parent));
     }
     // Allow the user to customize items added to the form
     if ($return = $this->trigger('render', array($field, $parent))) {
         $html = $return;
     }
     // Append the html to the form
     if ($parent instanceof Brick) {
         $parent->append($field);
         return parent::append($parent);
     }
     return parent::append($field);
 }