You are here

function acquia_lift_goal_type_create_completed_callback in Acquia Lift Connector 7.2

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

Ctools form processing complete handler for the creation of a new goal by type.

See also

acquia_lift_create_ctools_form().

1 string reference to 'acquia_lift_goal_type_create_completed_callback'
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.

File

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

Code

function acquia_lift_goal_type_create_completed_callback($form, &$form_state) {
  $agent = $form_state['values']['agent'];
  $settings = acquia_lift_get_campaign_details();
  if ($settings[$agent->machine_name]['verified'] && personalize_agent_get_status($agent->machine_name) === PERSONALIZE_STATUS_NOT_STARTED) {
    $message = t('Goal added. You can now !start the personalization.', array(
      '!start' => l(t('start'), 'admin/structure/personalize/' . $agent->machine_name),
    ));
  }
  else {
    $message = personalize_sanitize_string($form_state['acquia_lift']['goal_name']) . ' ' . t('goal added to personalization.');
  }

  // Load updated data about custom defined visitor actions.
  $actions = visitor_actions_custom_load_multiple();
  $commands = array(
    ctools_modal_command_dismiss(),
    ajax_command_settings(array(
      'acquia_lift' => array(
        'campaigns' => $settings,
        'customActions' => $actions,
      ),
    ), TRUE),
    acquia_lift_command_messagebox($message, 10),
  );
  return $commands;
}