Commit eb2b4128 authored by alexpott's avatar alexpott

Issue #2002426 by rootwork, hugo.lallo, Dan Reinders: Rename Views method...

Issue #2002426 by rootwork, hugo.lallo, Dan Reinders: Rename Views method click_sortable() to clickSortable().
parent 9c5e4bc7
...@@ -231,7 +231,7 @@ function add_field_table($use_groupby) { ...@@ -231,7 +231,7 @@ function add_field_table($use_groupby) {
/** /**
* Determine if this field is click sortable. * Determine if this field is click sortable.
*/ */
function click_sortable() { public function clickSortable() {
// Not click sortable in any case. // Not click sortable in any case.
if (empty($this->definition['click sortable'])) { if (empty($this->definition['click sortable'])) {
return FALSE; return FALSE;
......
...@@ -78,9 +78,9 @@ public function query() { ...@@ -78,9 +78,9 @@ public function query() {
} }
/** /**
* Overrides \Drupal\views\Plugin\views\Plugin\field\FieldPluginBase::click_sortable(). * {@inheritdoc}
*/ */
public function click_sortable() { public function clickSortable() {
return FALSE; return FALSE;
} }
......
...@@ -181,7 +181,7 @@ public function clickSort($order) { ...@@ -181,7 +181,7 @@ public function clickSort($order) {
* The value of 'click sortable' from the plugin definition, this defaults * The value of 'click sortable' from the plugin definition, this defaults
* to TRUE if not set. * to TRUE if not set.
*/ */
function click_sortable() { public function clickSortable() {
return isset($this->definition['click sortable']) ? $this->definition['click sortable'] : TRUE; return isset($this->definition['click sortable']) ? $this->definition['click sortable'] : TRUE;
} }
......
...@@ -277,7 +277,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -277,7 +277,7 @@ public function buildOptionsForm(&$form, &$form_state) {
'#options' => $field_names, '#options' => $field_names,
'#default_value' => $column, '#default_value' => $column,
); );
if ($handlers[$field]->click_sortable()) { if ($handlers[$field]->clickSortable()) {
$form['info'][$field]['sortable'] = array( $form['info'][$field]['sortable'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#default_value' => !empty($this->options['info'][$field]['sortable']), '#default_value' => !empty($this->options['info'][$field]['sortable']),
......
...@@ -524,23 +524,23 @@ function testIsValueEmpty() { ...@@ -524,23 +524,23 @@ function testIsValueEmpty() {
* Tests whether the filters are click sortable as expected. * Tests whether the filters are click sortable as expected.
*/ */
public function testClickSortable() { public function testClickSortable() {
// Test that click_sortable is TRUE by default. // Test that clickSortable is TRUE by default.
$item = array( $item = array(
'table' => 'views_test_data', 'table' => 'views_test_data',
'field' => 'name', 'field' => 'name',
); );
$plugin = views_get_handler($item, 'field'); $plugin = views_get_handler($item, 'field');
$this->assertTrue($plugin->click_sortable(), 'TRUE as a default value is correct.'); $this->assertTrue($plugin->clickSortable(), 'TRUE as a default value is correct.');
// Test that click_sortable is TRUE by when set TRUE in the data. // Test that clickSortable is TRUE by when set TRUE in the data.
$item['field'] = 'id'; $item['field'] = 'id';
$plugin = views_get_handler($item, 'field'); $plugin = views_get_handler($item, 'field');
$this->assertTrue($plugin->click_sortable(), 'TRUE as a views data value is correct.'); $this->assertTrue($plugin->clickSortable(), 'TRUE as a views data value is correct.');
// Test that click_sortable is FALSE by when set FALSE in the data. // Test that clickSortable is FALSE by when set FALSE in the data.
$item['field'] = 'job'; $item['field'] = 'job';
$plugin = views_get_handler($item, 'field'); $plugin = views_get_handler($item, 'field');
$this->assertFalse($plugin->click_sortable(), 'FALSE as a views data value is correct.'); $this->assertFalse($plugin->clickSortable(), 'FALSE as a views data value is correct.');
} }
/** /**
......
...@@ -575,7 +575,7 @@ function template_preprocess_views_view_table(&$vars) { ...@@ -575,7 +575,7 @@ function template_preprocess_views_view_table(&$vars) {
// render the header labels // render the header labels
if ($field == $column && empty($fields[$field]->options['exclude'])) { if ($field == $column && empty($fields[$field]->options['exclude'])) {
$label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : ''); $label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : '');
if (empty($options['info'][$field]['sortable']) || !$fields[$field]->click_sortable()) { if (empty($options['info'][$field]['sortable']) || !$fields[$field]->clickSortable()) {
$vars['header'][$field] = $label; $vars['header'][$field] = $label;
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment