You are here

function bat_event_potential_references in Booking and Availability Management Tools for Drupal 7

Parameters

array $field:

array $options:

Return value

array

2 calls to bat_event_potential_references()
bat_event_autocomplete_validate in modules/bat_event/bat_event.module
Validation callback for a event state autocomplete element.
bat_event_reference_autocomplete in modules/bat_event/bat_event.module
Menu callback for the autocomplete results.

File

modules/bat_event/bat_event.module, line 1786
Manage Events - Events store the EventValue of a Unit over a period of time.

Code

function bat_event_potential_references($field, $options = array()) {

  // Fill in default options.
  $options += array(
    'string' => '',
    'match' => 'contains',
    'ids' => array(),
    'limit' => 0,
  );
  $results =& drupal_static(__FUNCTION__, array());

  // Create unique id for static cache.
  $cid = $field['field_name'] . ':' . $options['match'] . ':' . ($options['string'] !== '' ? $options['string'] : implode('-', $options['ids'])) . ':' . $options['limit'];
  if (!isset($results[$cid])) {
    $references = FALSE;
    if ($references === FALSE) {
      $references = _bat_event_potential_references($field, $options);
    }

    // Store the results.
    $results[$cid] = !empty($references) ? $references : array();
  }
  return $results[$cid];
}