You are here

function fullcalendar_create_add_form in FullCalendar Create 7

Form constructor for the hours add form.

1 string reference to 'fullcalendar_create_add_form'
fullcalendar_create_menu in ./fullcalendar_create.module
Implements hook_menu().

File

./fullcalendar_create.module, line 26
Provides click-to-create functionality for FullCalendar.

Code

function fullcalendar_create_add_form($form, &$form_state, $js, $type) {
  global $user;
  $node = (object) array(
    'uid' => $user->uid,
    'name' => isset($user->name) ? $user->name : '',
    'type' => $type,
    'language' => LANGUAGE_NONE,
  );
  $form_state['ajax'] = $js;
  if (!empty($_POST['fullcalendar_create_date_field'])) {
    $form_state['fullcalendar_create_date_field'] = $_POST['fullcalendar_create_date_field'];
  }
  $form_state['build_info']['args'] = array(
    $node,
  );
  form_load_include($form_state, 'inc', 'node', 'node.pages');
  ctools_include('modal');
  $output = ctools_modal_form_wrapper($type . '_node_form', $form_state);
  if (!$js) {
    return $output;
  }
  $commands = $output;
  if (!empty($form_state['executed'])) {
    ctools_include('ajax');
    $commands = array(
      ctools_modal_command_dismiss(),
      array(
        'command' => 'fullcalendar_create_reload',
      ),
    );
  }
  print ajax_render($commands);
  drupal_exit();
}