summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-01-04 11:58:51 (GMT)
committerAlex Pott2016-01-04 11:58:51 (GMT)
commit1546d71f807a3431e80dedbcdab5302f67bb7e24 (patch)
tree3da1e5e733a67fb973157c0adb13539dbe1b3015
parentbbd1baf2b8a9fd0da754a4fb08b75589fdea8745 (diff)
Issue #2605214 by Gábor Hojtsy, ChuChuNaKu, EclipseGc, dawehner: Views InOperator::getValueOptions() children do not return values like InOperator::getValueOptions()
-rw-r--r--core/modules/comment/src/Plugin/views/filter/NodeComment.php1
-rw-r--r--core/modules/file/src/Plugin/views/filter/Status.php1
-rw-r--r--core/modules/language/src/Tests/Views/FilterLanguageTest.php12
-rw-r--r--core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php7
-rw-r--r--core/modules/user/src/Plugin/views/filter/Name.php8
-rw-r--r--core/modules/user/src/Plugin/views/filter/Permissions.php1
-rw-r--r--core/modules/user/src/Plugin/views/filter/Roles.php2
-rw-r--r--core/modules/user/src/Tests/Views/HandlerFilterPermissionTest.php1
-rw-r--r--core/modules/user/src/Tests/Views/HandlerFilterRolesTest.php6
-rw-r--r--core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php2
-rw-r--r--core/modules/views/src/Plugin/views/filter/InOperator.php4
-rw-r--r--core/modules/views/src/Plugin/views/filter/LanguageFilter.php1
12 files changed, 40 insertions, 6 deletions
diff --git a/core/modules/comment/src/Plugin/views/filter/NodeComment.php b/core/modules/comment/src/Plugin/views/filter/NodeComment.php
index a83ec39..2340752 100644
--- a/core/modules/comment/src/Plugin/views/filter/NodeComment.php
+++ b/core/modules/comment/src/Plugin/views/filter/NodeComment.php
@@ -25,6 +25,7 @@ class NodeComment extends InOperator {
CommentItemInterface::CLOSED => $this->t('Closed'),
CommentItemInterface::OPEN => $this->t('Open'),
);
+ return $this->valueOptions;
}
}
diff --git a/core/modules/file/src/Plugin/views/filter/Status.php b/core/modules/file/src/Plugin/views/filter/Status.php
index 5d73454..7d6db6f 100644
--- a/core/modules/file/src/Plugin/views/filter/Status.php
+++ b/core/modules/file/src/Plugin/views/filter/Status.php
@@ -22,6 +22,7 @@ class Status extends InOperator {
if (!isset($this->valueOptions)) {
$this->valueOptions = _views_file_status();
}
+ return $this->valueOptions;
}
}
diff --git a/core/modules/language/src/Tests/Views/FilterLanguageTest.php b/core/modules/language/src/Tests/Views/FilterLanguageTest.php
index 591ad17..b3cc5d8 100644
--- a/core/modules/language/src/Tests/Views/FilterLanguageTest.php
+++ b/core/modules/language/src/Tests/Views/FilterLanguageTest.php
@@ -45,6 +45,18 @@ class FilterLanguageTest extends LanguageTestBase {
'name' => $name,
));
$this->assertIdenticalResultset($view, $expected, array('views_test_data_name' => 'name'));
+
+ $expected = [
+ '***LANGUAGE_site_default***',
+ '***LANGUAGE_language_interface***',
+ '***LANGUAGE_language_content***',
+ 'en',
+ 'xx-lolspeak',
+ 'und',
+ 'zxx'
+ ];
+ $this->assertIdentical(array_keys($view->filter['langcode']->getValueOptions()), $expected);
+
$view->destroy();
}
}
diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
index 46b8eb9..c660d20 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
@@ -89,7 +89,12 @@ class TaxonomyIndexTid extends ManyToOne {
public function hasExtraOptions() { return TRUE; }
- public function getValueOptions() { /* don't overwrite the value options */ }
+ /**
+ * {@inheritdoc}
+ */
+ public function getValueOptions() {
+ return $this->valueOptions;
+ }
protected function defineOptions() {
$options = parent::defineOptions();
diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php
index a4be2f5..0066f71 100644
--- a/core/modules/user/src/Plugin/views/filter/Name.php
+++ b/core/modules/user/src/Plugin/views/filter/Name.php
@@ -101,8 +101,12 @@ class Name extends InOperator {
// prevent array filter from removing our anonymous user.
}
- // Override to do nothing.
- public function getValueOptions() { }
+/**
+ * {@inheritdoc}
+ */
+ public function getValueOptions() {
+ return $this->valueOptions;
+ }
public function adminSummary() {
// set up $this->valueOptions for the parent summary
diff --git a/core/modules/user/src/Plugin/views/filter/Permissions.php b/core/modules/user/src/Plugin/views/filter/Permissions.php
index c113b2e..6cbb703 100644
--- a/core/modules/user/src/Plugin/views/filter/Permissions.php
+++ b/core/modules/user/src/Plugin/views/filter/Permissions.php
@@ -78,6 +78,7 @@ class Permissions extends ManyToOne {
$display_name = $this->moduleHandler->getName($provider);
$this->valueOptions[$display_name][$perm] = Html::escape(strip_tags($perm_item['title']));
}
+ return $this->valueOptions;
}
else {
return $this->valueOptions;
diff --git a/core/modules/user/src/Plugin/views/filter/Roles.php b/core/modules/user/src/Plugin/views/filter/Roles.php
index bcae6f9..e017c64 100644
--- a/core/modules/user/src/Plugin/views/filter/Roles.php
+++ b/core/modules/user/src/Plugin/views/filter/Roles.php
@@ -60,6 +60,8 @@ class Roles extends ManyToOne {
public function getValueOptions() {
$this->valueOptions = user_role_names(TRUE);
unset($this->valueOptions[RoleInterface::AUTHENTICATED_ID]);
+ return $this->valueOptions;
+
}
/**
diff --git a/core/modules/user/src/Tests/Views/HandlerFilterPermissionTest.php b/core/modules/user/src/Tests/Views/HandlerFilterPermissionTest.php
index b781f07..5cdf6b9 100644
--- a/core/modules/user/src/Tests/Views/HandlerFilterPermissionTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFilterPermissionTest.php
@@ -74,7 +74,6 @@ class HandlerFilterPermissionTest extends UserKernelTestBase {
$view->initDisplay();
$view->initHandlers();
- $view->filter['permission']->getValueOptions();
// Test the value options.
$value_options = $view->filter['permission']->getValueOptions();
diff --git a/core/modules/user/src/Tests/Views/HandlerFilterRolesTest.php b/core/modules/user/src/Tests/Views/HandlerFilterRolesTest.php
index b105583..6873a76 100644
--- a/core/modules/user/src/Tests/Views/HandlerFilterRolesTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFilterRolesTest.php
@@ -9,6 +9,7 @@ namespace Drupal\user\Tests\Views;
use Drupal\user\Entity\Role;
use Drupal\views\Entity\View;
+use Drupal\views\Views;
/**
* Tests the roles filter handler.
@@ -52,6 +53,11 @@ class HandlerFilterRolesTest extends UserKernelTestBase {
$expected['config'][] = 'user.role.test_user_role';
$this->assertEqual($expected, $view->getDependencies());
+ $view = Views::getView('test_user_name');
+ $view->initDisplay();
+ $view->initHandlers();
+ $this->assertEqual(array_keys($view->filter['roles_target_id']->getValueOptions()), ['test_user_role']);
+
$view = View::load('test_user_name');
$display = &$view->getDisplay('default');
$display['display_options']['filters']['roles_target_id'] = [
diff --git a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
index 00bc8c0..2e1fc3e 100644
--- a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
@@ -83,6 +83,8 @@ class HandlerFilterUserNameTest extends ViewTestBase {
$this->executeView($view);
$this->assertIdenticalResultset($view, array(array('uid' => $this->accounts[0]->id())), $this->columnMap);
+
+ $this->assertEqual($view->filter['uid']->getValueOptions(), NULL);
}
/**
diff --git a/core/modules/views/src/Plugin/views/filter/InOperator.php b/core/modules/views/src/Plugin/views/filter/InOperator.php
index 89a731c..cfcde0e 100644
--- a/core/modules/views/src/Plugin/views/filter/InOperator.php
+++ b/core/modules/views/src/Plugin/views/filter/InOperator.php
@@ -59,8 +59,8 @@ class InOperator extends FilterPluginBase {
* This can use a guard to be used to reduce database hits as much as
* possible.
*
- * @return
- * Return the stored values in $this->valueOptions if someone expects it.
+ * @return array|NULL
+ * The stored values from $this->valueOptions.
*/
public function getValueOptions() {
if (isset($this->valueOptions)) {
diff --git a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
index c42122c..f7eefb9 100644
--- a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
+++ b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
@@ -69,6 +69,7 @@ class LanguageFilter extends InOperator implements ContainerFactoryPluginInterfa
// lost when there are changes in the language configuration.
$this->valueOptions = $this->listLanguages(LanguageInterface::STATE_ALL | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED, array_keys($this->value));
}
+ return $this->valueOptions;
}
/**