From 8e740604dc8e1f50010119105caaf9030ab3d5c0 Mon Sep 17 00:00:00 2001 From: Jakob Perry Date: Wed, 16 Nov 2016 12:58:10 -0800 Subject: [PATCH] 2408937 --- modules/taxonomy/views_handler_field_taxonomy.inc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/taxonomy/views_handler_field_taxonomy.inc b/modules/taxonomy/views_handler_field_taxonomy.inc index 9dacb0d..3322d54 100644 --- a/modules/taxonomy/views_handler_field_taxonomy.inc +++ b/modules/taxonomy/views_handler_field_taxonomy.inc @@ -31,6 +31,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; @@ -52,6 +53,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); } @@ -80,6 +95,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; } -- 2.6.4 (Apple Git-63)