/** * {@inheritdoc} */ protected function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') { $query = parent::buildEntityFieldQuery($match, $match_operator); // Search only from the list of users allowed to be assigned to this issue. $assignees = $this->getAllowedAssignees(); if (!empty($assignees)) { $query->propertyCondition('uid', $assignees, 'IN'); } return $query; }
/** * Build an EntityFieldQuery to get referencable entities. */ protected function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') { // @todo Enable filtering by first OR last name. This will require adding // metadata and/or tags to the query, altering it using a // hook_query_TAG_alter(), and using a db_or() to generate the OR condition. // See http://drupal.stackexchange.com/questions/14499/using-or-with-entityfieldquery // and https://api.drupal.org/api/drupal/includes!database!database.inc/function/db_or/7 // and http://www.phase2technology.com/blog/or-queries-with-entityfieldquery/. // For now, the filter is just on first name. $query = parent::buildEntityFieldQuery($match, $match_operator); $query->propertyCondition('first_name', $match, $match_operator); return $query; }
/** * Overrides TicketStateSelectionHandler::buildEntityFieldQuery(). */ public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') { $group_type = $this->field['settings']['target_type']; if (empty($this->instance['field_mode']) || $group_type != 'node' || user_is_anonymous()) { return parent::buildEntityFieldQuery($match, $match_operator); } $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance, $this->entity_type, $this->entity); $query = $handler->buildEntityFieldQuery($match, $match_operator); // Show only the entities that are active groups. $query->propertyCondition('active', 1); $query->addMetaData('entityreference_selection_handler', $this); $query->addTag('entity_field_access'); return $query; }
/** * Build an EntityFieldQuery to get referencable entities. */ protected function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') { $query = parent::buildEntityFieldQuery($match, $match_operator); // Filtering by first and last name. EFQs do not support OR conditions, so // a tag is added, which allows the resulting query to be altered. In that // query_alter, all of the conditions are added, so they are not set here. // See http://drupal.stackexchange.com/questions/14499/using-or-with-entityfieldquery // and https://api.drupal.org/api/drupal/includes!database!database.inc/function/db_or/7 // and http://www.phase2technology.com/blog/or-queries-with-entityfieldquery/. $query->addTag('redhen_contact_generic_selection'); // Add a 'search_string' metadata so the query_alter can easily find the // search text. $query->addMetaData('search_string', $match); return $query; }
public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') { $query = parent::buildEntityFieldQuery($match, $match_operator); // The user entity doesn't have a label column. if (isset($match)) { $query->propertyCondition('name', $match, $match_operator); } // Adding the 'user_access' tag is sadly insufficient for users: core // requires us to also know about the concept of 'blocked' and // 'active'. if (!user_access('administer users')) { $query->propertyCondition('status', 1); } return $query; }
/** * {@inheritdoc} */ protected function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') { // We use the same settings as the parent class, therefore it's fine for // this to call the parent, as it will produce correct results. It's also // fine for methods we don't override such as countReferencableEntities() to // call this. return parent::buildEntityFieldQuery($match, $match_operator); }