You are here

function acquia_lift_create_ctools_form in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 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.

6 calls to acquia_lift_create_ctools_form()
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.
acquia_lift_goal_type_create_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate the ctools modal form to create a goal of a specific type.
acquia_lift_target_complete_audience_modal_callback in ./acquia_lift.admin.inc
Page callback to show the form to stop a test for a particular audience in a CTools modal window.

... See full list

File

./acquia_lift.admin.unibar.inc, line 1117
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);
}