public function Fulltext::query in Name Field 8
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/ Fulltext.php, line 114
Class
- Fulltext
- Filter by fulltext search.
Namespace
Drupal\name\Plugin\views\filterCode
public function query() {
$this
->ensureMyTable();
// Don't filter on empty strings.
if (empty($this->value[0])) {
return;
}
$field = "{$this->tableAlias}.{$this->realField}";
$fulltext_field = "LOWER(CONCAT(' ', COALESCE({$field}_title, ''), ' ', COALESCE({$field}_given, ''), ' ', COALESCE({$field}_middle, ''), ' ', COALESCE({$field}_family, ''), ' ', COALESCE({$field}_generational, ''), ' ', COALESCE({$field}_credentials, '')))";
$info = $this
->operators();
if (!empty($info[$this->operator]['method'])) {
$this
->{$info[$this->operator]['method']}($fulltext_field);
}
}