You are here

function acquia_lift_personalize_campaign_wizard_alter in Acquia Lift Connector 7.2

Basic handler for altering any part of the campaign wizard form.

Parameters

array $form: The existing campaign form structure to alter.

array $form_state: The form state.

stdClass $agent_data: The agent that is being altered (optional if creating). This will always be a targeting agent.

1 call to acquia_lift_personalize_campaign_wizard_alter()
acquia_lift_form_personalize_campaign_wizard_alter in ./acquia_lift.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function acquia_lift_personalize_campaign_wizard_alter(&$form, &$form_state, $agent_data = NULL) {
  $form['#attached']['library'][] = array(
    'acquia_lift',
    'acquia_lift.targeting_admin',
  );
  $form['#attached']['library'][] = array(
    'acquia_lift',
    'acquia_lift.help',
  );

  // We have to specify the include file so as not to lose it during rendering from ajax.
  // @see personalize_agent_form_ajax_submit()
  // @see drupal_retrieve_form():734
  $form_state['build_info']['files'][] = drupal_get_path('module', 'acquia_lift') . '/acquia_lift.admin.wizard.inc';
  module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');
  $editable = acquia_lift_target_definition_changes_allowed($agent_data);

  // Call the alter hooks for the generic form parts.
  call_user_func_array('acquia_lift_personalize_campaign_wizard_process_bar_alter', array(
    &$form,
    &$form_state,
    $agent_data,
    $editable,
  ));
  call_user_func_array('acquia_lift_personalize_campaign_wizard_base_alter', array(
    &$form,
    &$form_state,
    $agent_data,
    $editable,
  ));

  // Add in any section help if available.
  $function = 'acquia_lift_personalize_campaign_wizard_' . $form_state['storage']['step'] . '_help';
  if (function_exists($function)) {
    $form['section_help'] = call_user_func_array($function, array(
      &$form,
      &$form_state,
      $agent_data,
      $editable,
    ));
    $form['header']['#weight'] = -40;
    $form['agent_basic_info']['#weight'] = -30;
    $form['process_bar']['#weight'] = -20;
    $form['section_help']['#weight'] = -10;
  }

  // Now call any alter hooks that are specific to the storage step.
  $function = 'acquia_lift_personalize_campaign_wizard_' . $form_state['storage']['step'] . '_alter';
  if (function_exists($function)) {
    call_user_func_array($function, array(
      &$form,
      &$form_state,
      $agent_data,
      $editable,
    ));
  }

  // Update primary submit button.
  if (!empty($form['actions']['submit'])) {
    $form['actions']['submit']['#attributes']['class'][] = 'acquia-lift-submit-button';
  }
}