You are here

function _acquia_lift_personalize_campaign_wizard_goals_single_add in Acquia Lift Connector 7.2

Helper submit function to handle saving a new goal.

2 calls to _acquia_lift_personalize_campaign_wizard_goals_single_add()
acquia_lift_personalize_campaign_wizard_goals_single_submit in ./acquia_lift.admin.wizard.inc
Submit function for a single goal
acquia_lift_personalize_campaign_wizard_goals_submit in ./acquia_lift.admin.wizard.inc
Submit function for goals form.

File

./acquia_lift.admin.wizard.inc, line 2222
acquia_lift.admin.wizard.inc Functions specific to the Acquia Lift alteration of the campaign creation wizard.

Code

function _acquia_lift_personalize_campaign_wizard_goals_single_add($delta, $form, $form_state, $agent_data) {
  $type = $form_state['new_goals'][$delta];
  if (empty($type)) {
    return;
  }

  // Get a reference to the original values.
  $values = $form_state['values'];
  $form_state['values'] = $values['goals']['new'][$delta]['details'];
  $form_state['values']['agent'] = $agent_data;
  $form_state['values']['goal_type'] = $type;
  $save_form['goal']['action_name'] = $type == 'existing' ? $form['goals']['new'][$delta]['details']['action_name'] : array();
  module_load_include('inc', 'acquia_lift', 'acquia_lift.admin.unibar');
  acquia_lift_goal_type_create_form_submit($save_form, $form_state);

  // Restore the form state values.
  $form_state['values'] = $values;
}