You are here

function acquia_lift_goal_type_create_completed_callback in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 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 1112
acquia_lift.admin.unibar.inc

Code

function acquia_lift_goal_type_create_completed_callback($form, &$form_state) {
  $agent = $form_state['values']['agent'];
  $include_status = variable_get('acquia_lift_unibar_allow_status_change', TRUE);
  $settings = acquia_lift_get_campaign_details($include_status);
  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 campaign.', array(
      '!start' => $include_status ? t('start') : l(t('start'), 'admin/structure/personalize/' . $agent->machine_name . '/edit'),
    ));
  }
  else {
    $message = t('!goal goal added to campaign.', array(
      '!goal' => filter_xss($form_state['acquia_lift']['goal_name']),
    ));
  }

  // 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),
    acquia_lift_command_process_queue(),
  );
  return $commands;
}