Пример #1
0
 /**
  * Adds a label to the group/field
  *
  * @param  string $text       A label
  * @param  array  $attributes The label's attributes
  *
  * @return Field              A field
  */
 public function label($text, $attributes = array())
 {
     // Create the Label element
     $for = $this->id ?: $this->name;
     $label = $this->app['form']->label($text, $for, $attributes);
     // Set label
     $this->label = $label;
     if ($this->group) {
         $this->group->setLabel($label);
     }
     return $this;
 }
Пример #2
0
 /**
  * Close a field group
  *
  * @return string
  */
 public function closeGroup()
 {
     $closing = '';
     if (Group::$opened && isset(Group::$openGroup)) {
         $closing = Group::$openGroup->close();
     }
     // Close custom group
     Group::$opened = false;
     // Reset custom group reference
     Group::$openGroup = null;
     return $closing;
 }
Пример #3
0
 /**
  * Dispatch a call over to Group
  *
  * @param string $method     The method called
  * @param array  $parameters Its parameters
  *
  * @return Group
  */
 public function toGroup($method, $parameters)
 {
     // Disregards if the method isn't "group"
     if ($method != 'group') {
         return false;
     }
     // Create opener
     $group = new Form\Group($this->app, array_get($parameters, 0, null), array_get($parameters, 1, null));
     // Set custom group as true
     Form\Group::$opened = true;
     // Set custom group reference
     Form\Group::$openGroup = $group;
     return $group;
 }