Skip to content
Snippets Groups Projects
Commit e41c6e15 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2002388 by jeroen12345, toddtomlinson: Rename Views method build_sort() to buildSort().

parent 9048d3b2
No related branches found
No related tags found
No related merge requests found
......@@ -385,7 +385,7 @@ public function wizardSubmit(&$form, &$form_state, WizardInterface $wizard, &$di
* interfere with the sorts. If so it should build; if it returns
* any non-TRUE value, normal sorting will NOT be added to the query.
*/
function build_sort() { return TRUE; }
public function buildSort() { return TRUE; }
/**
* Called by the view builder to let the style build a second set of
......
......@@ -103,7 +103,7 @@ protected function defineOptions() {
/**
* {@inheritdoc}
*/
function build_sort() {
public function buildSort() {
$order = $this->request->query->get('order');
if (!isset($order) && ($this->options['default'] == -1 || empty($this->view->field[$this->options['default']]))) {
return TRUE;
......
......@@ -44,7 +44,7 @@ public function testTable() {
$view->initQuery();
$style_plugin = $view->style_plugin;
// Test the build_sort() method.
// Test the buildSort() method.
$request = new Request();
$this->container->enterScope('request');
$this->container->set('request', $request);
......@@ -52,20 +52,20 @@ public function testTable() {
$style_plugin->options['override'] = FALSE;
$style_plugin->options['default'] = '';
$this->assertTrue($style_plugin->build_sort(), 'If no order and no default order is specified, the normal sort should be used.');
$this->assertTrue($style_plugin->buildSort(), 'If no order and no default order is specified, the normal sort should be used.');
$style_plugin->options['default'] = 'id';
$this->assertTrue($style_plugin->build_sort(), 'If no order but a default order is specified, the normal sort should be used.');
$this->assertTrue($style_plugin->buildSort(), 'If no order but a default order is specified, the normal sort should be used.');
$request->attributes->set('order', $this->randomName());
$this->assertTrue($style_plugin->build_sort(), 'If no valid field is chosen for order, the normal sort should be used.');
$this->assertTrue($style_plugin->buildSort(), 'If no valid field is chosen for order, the normal sort should be used.');
$request->attributes->set('order', 'id');
$this->assertTrue($style_plugin->build_sort(), 'If a valid order is specified but the table is configured to not override, the normal sort should be used.');
$this->assertTrue($style_plugin->buildSort(), 'If a valid order is specified but the table is configured to not override, the normal sort should be used.');
$style_plugin->options['override'] = TRUE;
$this->assertFalse($style_plugin->build_sort(), 'If a valid order is specified and the table is configured to override, the normal sort should not be used.');
$this->assertFalse($style_plugin->buildSort(), 'If a valid order is specified and the table is configured to override, the normal sort should not be used.');
// Test the build_sort_post() method.
$request = new Request();
......
......@@ -1050,7 +1050,7 @@ public function build($display_id = NULL) {
// Build our sort criteria if we were instructed to do so.
if (!empty($this->build_sort)) {
// Allow the style handler to deal with sorting.
if ($this->style_plugin->build_sort()) {
if ($this->style_plugin->buildSort()) {
$this->_build('sort');
}
// allow the plugin to build second sorts as well.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment