You are here

function acquia_lift_goal_create_modal_callback in Acquia Lift Connector 7.2

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

Page callback to create a new goal by selecting the type of goal to create.

Parameters

bool $ajax: Indicates if the form is called with ajax support.

1 string reference to 'acquia_lift_goal_create_modal_callback'
acquia_lift_menu in ./acquia_lift.module
Implements hook_menu().

File

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

Code

function acquia_lift_goal_create_modal_callback($ajax) {
  if (!$ajax) {
    drupal_goto('admin/structure/personalize');
    return;
  }

  // Show the goal type selection form in a modal.
  ctools_include('modal');
  ctools_modal_add_js();
  module_load_include('inc', 'acquia_lift', 'acquia_lift.ui');
  $types = acquia_lift_goal_types_ui();

  // Handle differences in modal submits based on type of goal.
  foreach ($types as $id => &$type) {
    if ($id === 'element') {
      $type['modal'] = FALSE;
    }
    else {
      $type['modal'] = TRUE;
      $type['ctools_style'] = 'ctools-modal-acquia-lift-style';
    }
  }
  $output = theme('acquia_lift_type_list', array(
    'id' => 'acquia-lift-modal-goal-type-list',
    'items' => $types,
  ));
  return ctools_modal_render(t('Add a goal'), $output);
}