You are here

protected function EntityReference_SelectionHandler_Generic_party::buildEntityFieldQuery in Party 7

Same name and namespace in other branches
  1. 8.2 includes/entityreference/party.entityreference.inc \EntityReference_SelectionHandler_Generic_party::buildEntityFieldQuery()

Add a field condition to the EntityFieldQuery to limit by hats.

Overrides EntityReference_SelectionHandler_Generic::buildEntityFieldQuery

File

includes/entityreference/party.entityreference.inc, line 55
A entity reference selection handler class to allow us to make use of advance party features such as hats.

Class

EntityReference_SelectionHandler_Generic_party
Entity Selection Handler class for Party Entities

Code

protected function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') {
  $query = parent::buildEntityFieldQuery($match, $match_operator);

  // If party_hat is enabled filter by them
  if (module_exists('party_hat') && !empty($this->field['settings']['handler_settings']['target_hats'])) {
    $query
      ->fieldCondition('party_hat', 'hat_name', $this->field['settings']['handler_settings']['target_hats'], 'IN');
  }
  return $query;
}