Inheritance: extends HtmlObject\Traits\Tag
示例#1
0
文件: Field.php 项目: autocar/former
 /**
  * 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['former']->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
 /**
  * Close a field group
  *
  * @return string
  */
 public function closeGroup()
 {
     // Close custom group
     Group::$opened = false;
     return '</div>';
 }
示例#4
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;
     return $group;
 }