You are here

function acquia_lift_personalize_campaign_wizard_submit in Acquia Lift Connector 7.2

General Acquia Lift submission of campaign step form.

2 calls to acquia_lift_personalize_campaign_wizard_submit()
acquia_lift_personalize_campaign_wizard_goals_submit_element_add in ./acquia_lift.admin.wizard.inc
Submit handler for entering a URL to begin creation of an element goal.
acquia_lift_personalize_campaign_wizard_variations_submit_element_add in ./acquia_lift.admin.wizard.inc
Submit handler for entering a URL to begin creation an element variation.
4 string references to 'acquia_lift_personalize_campaign_wizard_submit'
acquia_lift_personalize_campaign_wizard_goals_alter in ./acquia_lift.admin.wizard.inc
Alter the goals form.
acquia_lift_personalize_campaign_wizard_review_alter in ./acquia_lift.admin.wizard.inc
Alter hook for the review portion of the campaign wizard.
acquia_lift_personalize_campaign_wizard_targeting_alter in ./acquia_lift.admin.wizard.inc
Alter hook for the targeting portion of the campaign wizard.
acquia_lift_personalize_campaign_wizard_variations_alter in ./acquia_lift.admin.wizard.inc
Alter hook for the variations portions of the campaign wizard.

File

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

Code

function acquia_lift_personalize_campaign_wizard_submit(&$form, &$form_state) {
  module_load_include('inc', 'personalize', 'personalize.admin');
  module_load_include('inc', 'personalize', 'personalize.admin.campaign');
  module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');

  // Only allow edit submit handlers to run if changes are allowed.
  $step_name = $form_state['storage']['step'];
  if (empty($form[$step_name]['#disabled'])) {

    // Run the base submit form handling.
    $agent_data = personalize_campaign_wizard_submit_base($form, $form_state);
    $agent_instance = personalize_agent_load_agent($agent_data->machine_name);

    // Call any step-specific submission handlers.
    $submit_function = 'acquia_lift_personalize_campaign_wizard_' . $form_state['storage']['step'] . '_submit';
    if (function_exists($submit_function)) {
      $submit_function($form, $form_state, $agent_data, $agent_instance);
    }

    // Save any changes to the campaign.
    personalize_agent_save($agent_data);
  }
  else {
    $agent_instance = personalize_agent_load_agent($form['#agent']->machine_name);
  }

  // If the subform submit handlers didn't already set a redirect, then set the
  // next step and rebuild the form.
  if (empty($form_state['redirect'])) {
    _personalize_campaign_wizard_rebuild($form_state, $agent_instance);
  }
}