You are here

public function Fulltext::op_contains in Name Field 8

Contains operation.

Parameters

string $fulltext_field: The db field.

File

src/Plugin/views/filter/Fulltext.php, line 135

Class

Fulltext
Filter by fulltext search.

Namespace

Drupal\name\Plugin\views\filter

Code

public function op_contains($fulltext_field) {
  $value = mb_strtolower($this->value[0]);
  $value = str_replace(' ', '%', $value);
  $placeholder = $this
    ->placeholder();
  $this->query
    ->addWhereExpression($this->options['group'], "{$fulltext_field} LIKE {$placeholder}", [
    $placeholder => '% ' . $value . '%',
  ]);
}