You are here

function acquia_lift_option_set_add_modal_callback in Acquia Lift Connector 7.2

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

Page callback to create a new option set.

Parameters

string $agent_name: The machine name of the current camaign.

string $ajax: Indicates if request is from 'ajax' or 'nojs' support.

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

File

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

Code

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

  // Show the option set 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_option_set_types_ui();

  // Indicate that type links should not open in a modal.
  foreach ($types as $type) {
    $type['modal'] = FALSE;
  }

  // Update the path for block creation.
  $agent_name = personalize_get_campaign_context();
  $types['block']['path'] = 'admin/structure/personalize/manage/' . $agent_name . '/variations';
  $types['block']['url_options']['query'][] = array(
    'create' => 'block',
  );
  $output = theme('acquia_lift_type_list', array(
    'id' => 'acquia-lift-option-set-type-list',
    'items' => $types,
  ));
  return ctools_modal_render(t('Add a variation set'), $output);
}