Exemple #1
0
 public function getFieldClasses(Field $field, $classes = array())
 {
     if ($field->isButton()) {
         $classes = $this->filterButtonClasses($classes);
     } else {
         $classes = $this->filterFieldClasses($classes);
     }
     return $this->addClassesToField($field, $classes);
 }
Exemple #2
0
 /**
  * Add classes to a field
  *
  * @param Field $field
  * @param array $classes The possible classes to add
  *
  * @return Field
  */
 public function getFieldClasses(Field $field, $classes)
 {
     // Add inline class for checkables
     if ($field->isCheckable() and in_array('inline', $classes)) {
         $field->inline();
     }
     // Filter classes according to field type
     if ($field->isButton()) {
         $classes = $this->filterButtonClasses($classes);
     } else {
         $classes = $this->filterFieldClasses($classes);
     }
     return $this->addClassesToField($field, $classes);
 }
Exemple #3
0
 /**
  * Add classes to a field
  *
  * @param Field $field
  * @param array $classes The possible classes to add
  *
  * @return Field
  */
 public function getFieldClasses(Field $field, $classes)
 {
     // Add inline class for checkables
     if ($field->isCheckable() and in_array('inline', $classes)) {
         $field->inline();
     }
     // Filter classes according to field type
     if ($field->isButton()) {
         $classes = $this->filterButtonClasses($classes);
     } else {
         $classes = $this->filterFieldClasses($classes);
     }
     // Add form-control class for text-type, textarea and select fields
     // As text-type is open-ended we instead exclude those that shouldn't receive the class
     if (!$field->isCheckable() and !$field->isButton() and !in_array($field->getType(), array('file', 'plaintext')) and !in_array('form-control', $classes)) {
         $classes[] = 'form-control';
     }
     return $this->addClassesToField($field, $classes);
 }