예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 /**
  * 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) . '>';
 }
예제 #3
0
 /**
  * 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;
 }
예제 #4
0
 /**
  * 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>';
 }
예제 #5
0
파일: Input.php 프로젝트: raftalks/former
 /**
  * Render a text element as a search element
  */
 private function asSearch()
 {
     $this->type = 'text';
     $this->attributes = Helpers::addClass($this->attributes, 'search-query');
 }
예제 #6
0
파일: Field.php 프로젝트: raftalks/former
 /**
  * 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);
 }
예제 #7
0
 /**
  * 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);
 }