You are here

function acquia_lift_review_form in Acquia Lift Connector 7

Final review form for applying targeting changes.

Parameters

$agent: A stdClass object representing the agent.

1 string reference to 'acquia_lift_review_form'
acquia_lift_menu in ./acquia_lift.module
Implements hook_menu().

File

./acquia_lift.admin.inc, line 1420
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_review_form($form, &$form_state, $agent) {
  if ($agent->plugin != 'acquia_lift_target') {
    drupal_goto('admin/structure/personalize');
  }
  $form = array();
  $form['agent'] = array(
    '#type' => 'value',
    '#value' => $agent->machine_name,
  );
  $saved_targeting = array();
  if (!empty($agent->data['lift_targeting'])) {
    $saved_targeting = $agent->data['lift_targeting'];
  }
  $option_set = acquia_lift_get_option_set_for_targeting($agent->machine_name);
  $running_targeting = acquia_lift_get_structure_from_targeting($option_set);

  // Only show a submit button if there are actual changes to apply.
  if (!empty($saved_targeting) && $saved_targeting != $running_targeting) {
    drupal_set_message(t('Saving this form will restructure your personalization and could result in loss of data about existing tests.'), 'warning');
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Confirm changes'),
    );
  }
  else {
    $form['all_good'] = array(
      '#type' => 'markup',
      '#markup' => t('No changes to apply. !change', array(
        '!change' => l(t('Make changes to the targeting for this campaign.'), 'admin/structure/personalize/manage/' . $agent->machine_name . '/lift-target'),
      )),
    );
  }
  return $form;
}