You are here

function calendar_systems_calendar_form in Calendar Systems 6.2

Form callback for a calendar administration settings.

Parameters

$form_state: Form state array.

$identifier: Calendar identifier.

Return value

An array of form elements.

1 string reference to 'calendar_systems_calendar_form'
calendar_systems_menu in ./calendar_systems.module
Implements hook_menu().

File

./calendar_systems.admin.inc, line 162
Implements necessary callbacks for Calendar Systems administration forms.

Code

function calendar_systems_calendar_form(&$form_state, $identifier) {

  // Get the information of the passed calendar identifier.
  $calendar = calendar_systems_calendars('calendar', $identifier);

  // If the calendar is already available across the system,
  // and it has a config callback, get its form array and render.
  if ($calendar && function_exists($calendar['config callback'])) {

    // We pas the calendar configuration to its config callback,
    // so it doesn't need to know about how to fetch that from db.
    $form = $calendar['config callback']($calendar['config']);

    // Append calendar information.
    $form['calendar'] = array(
      '#type' => 'value',
      '#value' => $calendar,
    );

    // And submit button.
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );

    // Set calendar configuration page title.
    drupal_set_title(t('@calendar Configuration', array(
      '@calendar' => calendar_systems_calendar_title($identifier),
    )));
    return $form;
  }

  // Passed calendar is not available.
  drupal_not_found();
  exit;
}