diff --git a/core/modules/comment/src/Plugin/views/filter/NodeComment.php b/core/modules/comment/src/Plugin/views/filter/NodeComment.php index 238c05e867fa26ed92e59960822bbfd125cdae73..baabb721d56316ba5cfecbe3082e261822f6c6e8 100644 --- a/core/modules/comment/src/Plugin/views/filter/NodeComment.php +++ b/core/modules/comment/src/Plugin/views/filter/NodeComment.php @@ -14,12 +14,17 @@ */ class NodeComment extends InOperator { + /** + * {@inheritdoc} + */ public function getValueOptions() { - $this->valueOptions = [ - CommentItemInterface::HIDDEN => $this->t('Hidden'), - CommentItemInterface::CLOSED => $this->t('Closed'), - CommentItemInterface::OPEN => $this->t('Open'), - ]; + if (!isset($this->valueOptions)) { + $this->valueOptions = [ + CommentItemInterface::HIDDEN => $this->t('Hidden'), + CommentItemInterface::CLOSED => $this->t('Closed'), + CommentItemInterface::OPEN => $this->t('Open'), + ]; + } 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 dc4d7b2abda76f999ed33c263ac2579733b2df9c..939b59c93a4743c6c255bae33e3b7d88b4737518 100644 --- a/core/modules/user/src/Plugin/views/filter/Roles.php +++ b/core/modules/user/src/Plugin/views/filter/Roles.php @@ -52,11 +52,16 @@ public static function create(ContainerInterface $container, array $configuratio ); } + /** + * {@inheritdoc} + */ public function getValueOptions() { - $roles = $this->roleStorage->loadMultiple(); - unset($roles[RoleInterface::ANONYMOUS_ID]); - unset($roles[RoleInterface::AUTHENTICATED_ID]); - $this->valueOptions = array_map(fn(RoleInterface $role) => $role->label(), $roles); + if (!isset($this->valueOptions)) { + $roles = $this->roleStorage->loadMultiple(); + unset($roles[RoleInterface::ANONYMOUS_ID]); + unset($roles[RoleInterface::AUTHENTICATED_ID]); + $this->valueOptions = array_map(fn(RoleInterface $role) => $role->label(), $roles); + } return $this->valueOptions; } diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php index 81c2f47aa81a001c2bfa18d53a8f14e16171f531..4ea7a07d18487e7d997191ea2d97666cc0eddead 100644 --- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php +++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php @@ -153,6 +153,8 @@ public function getValueOptions() { if (!isset($this->valueOptions)) { $this->valueOptions = [1 => $this->t('True'), 0 => $this->t('False')]; } + + return $this->valueOptions; } protected function defineOptions() {