You are here

function acquia_lift_create_ctools_form in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.admin.unibar.inc \acquia_lift_create_ctools_form()

Handles generating a CTools form window for a particular form.

Parameters

string $title: The title for the modal window.

$form_name: The name of the form to retrieve.

null $args: An array of form arguments to pass to the form.

null $callback: A callback to call when the form has been executed. The callback will receive the $form and $form_state arguments and should return the array of AJAX commands to execute. If empty then the modal will simply be dismissed.

8 calls to acquia_lift_create_ctools_form()
acquia_lift_campaign_start_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a start campaign screen.
acquia_lift_campaign_type_create_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate the ctools modal form to create a campaign of a specific type.
acquia_lift_element_variation_delete_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate an element variation delete confirm modal window.
acquia_lift_goal_delete_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a goal delete confirm modal window.
acquia_lift_goal_rename_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a goal rename modal window.

... See full list

File

./acquia_lift.admin.unibar.inc, line 1664
acquia_lift.admin.unibar.inc

Code

function acquia_lift_create_ctools_form($title, $form_name, $args = array(), $callback = NULL) {
  ctools_include('modal');
  ctools_include('ajax');
  ctools_modal_add_js();
  ctools_js_load('ajax-responder');
  $form_state = array(
    'ajax' => TRUE,
    'title' => $title,
    'build_info' => array(
      'args' => $args,
    ),
  );
  $output = ctools_modal_form_wrapper($form_name, $form_state);
  if ($form_state['executed']) {

    // Form has been processed to generate the output commands.
    if (is_callable($callback)) {
      $output = $callback($output, $form_state);
    }
    else {
      $output = array(
        ctools_modal_command_dismiss(),
      );
    }
  }
  personalize_ajax_commands_deliver($output);
}