function EntityFieldQuery::addTag

Adds a tag to the query.

Tags are strings that mark a query so that hook_query_alter() and hook_query_TAG_alter() implementations may decide if they wish to alter the query. A query may have any number of tags, and they must be valid PHP identifiers (composed of letters, numbers, and underscores). For example, queries involving nodes that will be displayed for a user need to add the tag 'node_access', so that the node module can add access restrictions to the query.

If an entity field query has tags, it must also have an entity type specified, because the alter hook will need the entity base table.

Parameters

string $tag: The tag to add.

Return value

EntityFieldQuery The called object.

File

includes/entity.inc, line 1153

Class

EntityFieldQuery
Retrieves entities matching a given set of conditions.

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.