You are here

function bat_event_load_state_by_machine_name in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 modules/bat_event/bat_event.module \bat_event_load_state_by_machine_name()

Returns information about the configuration of a given fixed event state.

Parameters

string $state_machine_name:

Return value

array|false

5 calls to bat_event_load_state_by_machine_name()
bat_event_get_calendar_response in modules/bat_event/bat_event.module
Given a date range and a set of valid states it will return all units within the set of valid states.
bat_event_get_matching_units_from_calendar in modules/bat_event/bat_event.module
Returns matching units based on a provided Calendar. A Calendar can be instantiated in a number of ways - bat_event offers bat_event_get_calendar. Using an already setup calendar multiple times reduces overall load.
bat_event_save_state in modules/bat_event/bat_event.module
bat_event_state_entity_metadata_field_verbatim_set in modules/bat_event/bat_event.module
Set event state value.
bat_event_unit_set_state in modules/bat_event/bat_event.module
VBO action: Assign fixed-state event to units.
3 string references to 'bat_event_load_state_by_machine_name'
bat_event_delete_states_by_type in modules/bat_event/bat_event.module
Delete the states associated with $type.
bat_event_save_state in modules/bat_event/bat_event.module
bat_event_states_form in modules/bat_event/bat_event.module
Implements form that handles the definition of states for fixed state events.

File

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

Code

function bat_event_load_state_by_machine_name($state_machine_name) {
  $event_states =& drupal_static(__FUNCTION__, array());
  if (!isset($event_states[$state_machine_name])) {
    $state_id = db_select('bat_event_state', 'n')
      ->fields('n', array(
      'id',
    ))
      ->condition('machine_name', $state_machine_name)
      ->execute()
      ->fetchField();
    $event_states[$state_machine_name] = bat_event_load_state($state_id);
  }
  return $event_states[$state_machine_name];
}