You are here

function _calendar_systems_build in Calendar Systems 6.2

Helper function to build an array of defined calendars.

Return value

A 2D array of available calendars info and names.

1 call to _calendar_systems_build()
calendar_systems_calendars in ./calendar_systems.module
API function to provide a list of available calendars.

File

./calendar_systems.module, line 352
Contains Calendar Systems module hooks, helpers and API functions.

Code

function _calendar_systems_build() {
  $names = $calendars = array();
  $calendars_defined = module_invoke_all('calendar_info');
  foreach ($calendars_defined as $identifier => $info) {

    // Skip lazy modules without a format callback.
    if (!isset($info['format callback']) || !function_exists($info['format callback'])) {
      continue;
    }

    // Loadup the calendar configs.
    $info['config'] = variable_get('calendar_systems_settings_' . $identifier, '');
    $calendars[$identifier] = $info;
    $names[$identifier] = $info['name'];
  }
  return array(
    $calendars,
    $names,
  );
}