You are here

public function EntityReference_SelectionHandler_Generic_user::buildEntityFieldQuery in Entity reference 7

Build an EntityFieldQuery to get referencable entities.

Overrides EntityReference_SelectionHandler_Generic::buildEntityFieldQuery

File

plugins/selection/EntityReference_SelectionHandler_Generic.class.php, line 379

Class

EntityReference_SelectionHandler_Generic_user
Override for the User type.

Code

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;
}