You are here

function availability_calendar_convert_state in Availability Calendars 7.3

Same name and namespace in other branches
  1. 7.5 availability_calendar.inc \availability_calendar_convert_state()
  2. 7.4 availability_calendar.inc \availability_calendar_convert_state()

or to be stored in the database.

  • Convert is_available from int to boolean.

Parameters

array $state: Array containing a state.

See also

array_walk() callback to convert all states retrieved from the Database abstraction layer

1 string reference to 'availability_calendar_convert_state'
availability_calendar_get_states in ./availability_calendar.inc
Returns an array of records (or labels) of states keyed by sid.

File

./availability_calendar.inc, line 295
General helper methods for Availability Calendar

Code

function availability_calendar_convert_state(&$state, $key, $op) {
  if ($op === 'bool') {
    $state['is_available'] = $state['is_available'] == 1;
  }
  else {
    if ($op === 'label') {
      $state = t($state['label']);
    }
  }
}