You are here

public function Query::addTag in Search API 8

Sets the given tag on this query.

Tags are strings that categorize a query. A query may have any number of tags. Tags are used to mark a query so that alter hooks may decide if they wish to take action. Tags should be all lower-case and contain only letters, numbers, and underscore, and start with a letter. That is, they should follow the same rules as PHP identifiers in general.

The call will be ignored if the tag is already set on this query.

Parameters

string $tag: The tag to set.

Return value

$this

Overrides QueryInterface::addTag

See also

hook_search_api_query_TAG_alter()

File

src/Query/Query.php, line 715

Class

Query
Provides a standard implementation for a Search API query.

Namespace

Drupal\search_api\Query

Code

public function addTag($tag) {
  $this->tags[$tag] = $tag;
  return $this;
}