diff --git a/modules/taxonomy/views_handler_field_taxonomy.inc b/modules/taxonomy/views_handler_field_taxonomy.inc index 48da283d95df7d561e7f269d8063887cd981799e..2442cfff50ccffe90523afcde68d97fa3e3bf7ff 100644 --- a/modules/taxonomy/views_handler_field_taxonomy.inc +++ b/modules/taxonomy/views_handler_field_taxonomy.inc @@ -30,6 +30,7 @@ class views_handler_field_taxonomy extends views_handler_field { function option_definition() { $options = parent::option_definition(); + $options['case'] = array('default' => 'none'); $options['link_to_taxonomy'] = array('default' => FALSE, 'bool' => TRUE); $options['convert_spaces'] = array('default' => FALSE, 'bool' => TRUE); return $options; @@ -51,6 +52,20 @@ class views_handler_field_taxonomy extends views_handler_field { '#type' => 'checkbox', '#default_value' => !empty($this->options['convert_spaces']), ); + $form['case'] = array( + '#type' => 'select', + '#title' => t('Case'), + '#description' => t('When taxonomy term field, select how to transform the case of the filter value.'), + '#options' => array( + 'none' => t('No transform'), + 'upper' => t('Upper case'), + 'lower' => t('Lower case'), + 'ucfirst' => t('Capitalize first letter'), + 'ucwords' => t('Capitalize each word'), + ), + '#default_value' => !empty($this->options['case']) ? $this->options['case'] : 'none', + '#fieldset' => 'more', + ); parent::options_form($form, $form_state); } @@ -75,6 +90,10 @@ class views_handler_field_taxonomy extends views_handler_field { $data = str_replace(' ', '-', $data); } + if (!empty($this->options['case']) && $this->options['case'] !== 'none') { + $data = $this->case_transform($data, $this->options['case']); + } + return $data; }