You are here

function bat_calendar_reference_event_types_potential_references in Booking and Availability Management Tools for Drupal 7

Parameters

array $field:

array $options:

Return value

array

2 calls to bat_calendar_reference_event_types_potential_references()
bat_calendar_reference_autocomplete_event_type_validate in modules/bat_calendar_reference/bat_calendar_reference.module
Validate event type.
bat_calendar_reference_event_types_autocomplete in modules/bat_calendar_reference/bat_calendar_reference.module
Menu callback for the event types autocomplete results.

File

modules/bat_calendar_reference/bat_calendar_reference.module, line 457
Defines a field type for referencing event information.

Code

function bat_calendar_reference_event_types_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_calendar_reference_event_types_potential_references($field, $options);
    }

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