Issue #2002388 by jeroen12345, toddtomlinson: Rename Views method build_sort() to buildSort().
parent
9048d3b28d
commit
e41c6e1546
|
@ -385,7 +385,7 @@ abstract class StylePluginBase extends PluginBase {
|
|||
* 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 @@ class Table extends StylePluginBase {
|
|||
/**
|
||||
* {@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 @@ class StyleTableUnitTest extends PluginUnitTestBase {
|
|||
$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 @@ class StyleTableUnitTest extends PluginUnitTestBase {
|
|||
$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 @@ class ViewExecutable {
|
|||
// 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.
|
||||
|
|
Loading…
Reference in New Issue