You are here

function availability_calendars_node_edit_form_alter in Availability Calendars 7.2

Same name and namespace in other branches
  1. 6.2 availability_calendars.node.inc \availability_calendars_node_edit_form_alter()

Alters the form for node edit forms for supported content types.

Called by our hook_form_BASE_FORM_ID_alter implementation. For parameters

See also

http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...

1 call to availability_calendars_node_edit_form_alter()
availability_calendars_form_node_form_alter in ./availability_calendars.module
Implements hook_form_BASE_FORM_ID_alter(). Alters node edit forms for supported content types.

File

./availability_calendars.node.inc, line 20

Code

function availability_calendars_node_edit_form_alter(&$form, &$form_state, $form_id) {
  $node = node_load($form['nid']['#value']);
  $settings = availability_calendars_get_settings($node);
  $form['availability_calendars'] = array(
    '#type' => 'fieldset',
    '#title' => t('Availability calendar settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => TRUE,
  );
  $form['availability_calendars']['showteaser'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show availability calendars within teasers'),
    '#default_value' => $settings->showteaser,
  );

  // Allow users to choose whether a key should be shown on the node on a per node basis.
  $form['availability_calendars']['showkey'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show a key for the availability calendars'),
    '#default_value' => $settings->showkey,
  );

  // Allow users to choose whether the edit link should be shown or not.
  $form['availability_calendars']['showeditlink'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show an edit link per month on the edit availability calendar tab'),
    '#description' => t('You will need to enable this option if you want to edit week notes or want to edit the statuses per day using dropdowns.'),
    '#default_value' => $settings->showeditlink,
  );

  // Allow users to choose whether the week notes should be shown or not.
  $form['availability_calendars']['showweeknotes'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show a note before each week of the availability calendars'),
    '#default_value' => $settings->showweeknotes,
  );

  // Whether to use only the first letter for the day of the week or not.
  $form['availability_calendars']['firstletter'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use only the first letter from the day of the week'),
    '#default_value' => $settings->firstletter,
  );
  $form['availability_calendars']['hideold'] = array(
    '#type' => 'checkbox',
    '#title' => t('Do not show availability state of dates in the past'),
    '#default_value' => $settings->hideold,
  );
  $form['availability_calendars']['splitday'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow split day statuses'),
    '#default_value' => $settings->splitday,
  );
  $form['availability_calendars']['startofweek'] = array(
    '#type' => 'select',
    '#title' => t('First day of week'),
    '#default_value' => $settings->startofweek,
    '#options' => array(
      6 => t('Monday'),
      5 => t('Tuesday'),
      4 => t('Wednesday'),
      3 => t('Thursday'),
      2 => t('Friday'),
      1 => t('Saturday'),
      0 => t('Sunday'),
    ),
  );
  $form['availability_calendars']['monthcount'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of months to display'),
    '#default_value' => $settings->monthcount,
  );
  $form['availability_calendars']['editormonthcount'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of months to display to editors'),
    '#default_value' => $settings->editormonthcount,
    '#description' => t("The number of months to display to visitors who are allowed to edit the calendar to be displayed. Setting this larger than the previous value allows editors to enter information into future calendars before it is made publicly available."),
  );
  $form['availability_calendars']['defaultstatus'] = array(
    '#type' => 'select',
    '#title' => t('Default status for each day'),
    '#default_value' => $settings->defaultstatus,
    '#options' => availability_calendars_options(),
  );
}