You are here

public function OaTeams_SelectionHandler::getReferencableEntities in Open Atrium Core 7.2

Implements EntityReferenceHandler::getReferencableEntities().

Overrides EntityReference_SelectionHandler::getReferencableEntities

2 calls to OaTeams_SelectionHandler::getReferencableEntities()
OaTeams_SelectionHandler::countReferencableEntities in modules/oa_teams/plugins/entityreference_selection/OaTeams_SelectionHandler.class.php
Implements EntityReferenceHandler::countReferencableEntities().
OaTeams_SelectionHandler::validateAutocompleteInput in modules/oa_teams/plugins/entityreference_selection/OaTeams_SelectionHandler.class.php
Implements EntityReferenceHandler::validateAutocompleteInput().

File

modules/oa_teams/plugins/entityreference_selection/OaTeams_SelectionHandler.class.php, line 39
Contains the OaTeams_SelectionHandler class.

Class

OaTeams_SelectionHandler
An EntityReference selection plugin for Open Atrium Teams.

Code

public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
  $nids = array_keys(oa_teams_get_teams_for_space());
  $teams = node_load_multiple($nids);
  $options = array(
    OA_TEAM_TYPE => array(),
  );
  $count = 0;
  foreach ($teams as $nid => $team) {
    $count++;
    $label = $this
      ->getLabel($team);
    if (!$match || stripos($label, $match) !== FALSE) {
      $options[OA_TEAM_TYPE][$nid] = check_plain($this
        ->getLabel($team));
    }
    if ($limit && $count == $limit) {
      break;
    }
  }
  return $options;
}