public function AllowedLanguages::query in Allowed Languages 2.x
Same name and namespace in other branches
- 8 src/Plugin/views/filter/AllowedLanguages.php \Drupal\allowed_languages\Plugin\views\filter\AllowedLanguages::query()
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides FilterPluginBase::query
File
- src/
Plugin/ views/ filter/ AllowedLanguages.php, line 31
Class
- AllowedLanguages
- Filter content by the current users allowed languages.
Namespace
Drupal\allowed_languages\Plugin\views\filterCode
public function query() {
$allowed_languages = \Drupal::service('allowed_languages.allowed_languages_manager')
->assignedLanguages();
if ($allowed_languages) {
$this
->ensureMyTable();
$field = "{$this->tableAlias}.{$this->realField}";
$value = array_values($allowed_languages);
$this->query
->addWhere($this->options['group'], $field, $value, 'IN');
}
}