Skip to content

Instantly share code, notes, and snippets.

@slattery
Created June 24, 2025 21:21
Show Gist options
  • Save slattery/e989d1b9bb7363968bb44e839237aa58 to your computer and use it in GitHub Desktop.
Save slattery/e989d1b9bb7363968bb44e839237aa58 to your computer and use it in GitHub Desktop.
views_array_filter.10.4.x.patch
diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
index 8202277aa55..2a3f7003360 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
@@ -391,7 +391,7 @@ public function adminSummary() {
// Set up $this->valueOptions for the parent summary
$this->valueOptions = [];
- if ($this->value) {
+ if ($this->value && is_array($this->value)) {
$this->value = array_filter($this->value);
$terms = Term::loadMultiple($this->value);
foreach ($terms as $term) {
@@ -410,6 +410,10 @@ public function calculateDependencies() {
$vocabulary = $this->vocabularyStorage->load($this->options['vid']);
$dependencies[$vocabulary->getConfigDependencyKey()][] = $vocabulary->getConfigDependencyName();
+ if (!is_array($this->options['value'])) {
+ return;
+ }
+
foreach ($this->termStorage->loadMultiple($this->options['value']) as $term) {
$dependencies[$term->getConfigDependencyKey()][] = $term->getConfigDependencyName();
}
diff --git a/core/modules/views/src/Plugin/views/filter/ManyToOne.php b/core/modules/views/src/Plugin/views/filter/ManyToOne.php
index f4049573b6a..6ed2f7b9717 100644
--- a/core/modules/views/src/Plugin/views/filter/ManyToOne.php
+++ b/core/modules/views/src/Plugin/views/filter/ManyToOne.php
@@ -130,7 +130,7 @@ public function ensureMyTable() {
}
protected function opHelper() {
- if (empty($this->value)) {
+ if (empty($this->value) || !is_array($this->value)) {
return;
}
// Form API returns unchecked options in the form of option_id => 0. This
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment