You are here

function fullcalendar_create_fullcalendar_options_form in FullCalendar Create 7

Implements hook_fullcalendar_options_form().

File

includes/fullcalendar_create.fullcalendar.inc, line 46
Provides extra FullCalendar configuration options.

Code

function fullcalendar_create_fullcalendar_options_form(&$form, &$form_state, &$view) {
  $node_type = node_type_get_names();
  $bundles = array();
  foreach ($view->view->field as $field_name => $field) {
    if (fullcalendar_field_is_date($field)) {
      foreach ($field->field_info['bundles']['node'] as $bundle) {
        $bundles[$bundle] = $node_type[$bundle];
      }
    }
  }
  $form['fullcalendar_create']['click'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add new events when clicking on a day'),
    '#default_value' => $view->options['fullcalendar_create']['click'],
    '#data_type' => 'bool',
  );
  $form['fullcalendar_create']['select'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add new events when selecting a day'),
    '#default_value' => $view->options['fullcalendar_create']['select'],
    '#data_type' => 'bool',
  );
  $dependency = array(
    'edit-style-options-fullcalendar-create-click' => array(
      1,
    ),
    'edit-style-options-fullcalendar-create-select' => array(
      1,
    ),
  );
  $form['fullcalendar_create']['node_type'] = array(
    '#type' => 'select',
    '#title' => t('Select the node type to prepopulate'),
    '#options' => $bundles,
    '#default_value' => $view->options['fullcalendar_create']['node_type'],
    '#dependency' => $dependency,
  );
  $form['fullcalendar_create']['date_field'] = array(
    '#type' => 'select',
    '#title' => t('Select the date field to prepopulate'),
    '#multiple' => TRUE,
    '#options' => $view
      ->fullcalendar_parse_fields(FALSE),
    '#default_value' => $view->options['fullcalendar_create']['date_field'],
    '#dependency' => $dependency,
  );
  $form['fullcalendar_create']['days'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Allow creation of events on'),
    '#default_value' => $view->options['fullcalendar_create']['days'],
    '#options' => drupal_map_assoc(date_week_days_untranslated()),
    '#dependency' => $dependency,
  );
}