/** * Add a class to the current field * * @param string $class The class to add */ public function addClass($class) { if (is_array($class)) { $class = implode(' ', $class); } $this->attributes = \Former\Helpers::addClass($this->attributes, $class); return $this; }
/** * Opens a control group * * @return string Opening tag */ private function open() { // If any errors, set state to errors $errors = Former::getErrors(); if ($errors) { $this->state('error'); } // Retrieve state and append it to classes if ($this->state) { $this->attributes = Helpers::addClass($this->attributes, $this->state); } // Required state if (Former::field()->isRequired()) { $this->attributes = Helpers::addClass($this->attributes, Config::get('required_class')); } return '<div' . HTML::attributes($this->attributes) . '>'; }
/** * Add the correct classes to a group * * @param array $attributes The group's attributes * @return array The modified attributes */ public static function getGroupClasses($attributes) { if (static::is('bootstrap')) { $attributes = Helpers::addClass($attributes, 'control-group'); } return $attributes; }
/** * Prints out the current tag * * @return string An uneditable input tag */ public function __toString() { $this->attributes = Helpers::addClass($this->atteibutes, 'uneditable-input'); return '<span' . HTML::attributes($attributes) . '>' . HTML::entities($value) . '</span>'; }
/** * Render a text element as a search element */ private function asSearch() { $this->type = 'text'; $this->attributes = Helpers::addClass($this->attributes, 'search-query'); }
/** * Add a class to the current field * * @param string $class The class to add */ public function addClass($class) { $this->attributes = Helpers::addClass($this->attributes, $class); }
/** * Prints out the current label * * @param string $name A field to link the label to * @return string A <label> tag */ private function getLabel($name) { if (!$this->label) { return false; } extract($this->label); $attributes = Helpers::addClass($attributes, 'control-label'); return \Form::label($name, $label, $attributes); }