diff --git a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php index 7630e016..3c4382fc 100644 --- a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php +++ b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php @@ -419,4 +419,18 @@ class ObjectSuggestions extends Suggestions } } } + + /** + * Reduce {@see $customVarSources} to only given relations to fetch variables from + * + * @param string[] $relations + * + * @return $this + */ + public function onlyWithCustomVarSources(array $relations): self + { + $this->customVarSources = array_intersect_key($this->customVarSources, array_flip($relations)); + + return $this; + } }