You are here

function acquia_lift_page_variation_delete_form in Acquia Lift Connector 7

Form handler to generate a confirmation form to delete a variation.

This form is called within a ctools modal window.

Parameters

string $agent_name: The name of the campaign to edit.

string $variation_index: The index of the variation to rename.

1 string reference to 'acquia_lift_page_variation_delete_form'
acquia_lift_page_variation_delete_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a page variation delete confirm modal window.

File

./acquia_lift.admin.unibar.inc, line 810
acquia_lift.admin.unibar.inc

Code

function acquia_lift_page_variation_delete_form($form, &$form_state, $agent_name, $variation_index) {
  module_load_include('inc', 'acquia_lift', 'acquia_lift.page_variations');
  $variation_set_name = $agent_name;
  $variation_name = acquia_lift_page_variation_get_name($variation_set_name, $agent_name, $variation_index);
  ctools_include('modal');
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  $form = array();
  $form['agent_name'] = array(
    '#type' => 'value',
    '#value' => $agent_name,
  );
  $form['variation_set_name'] = array(
    '#type' => 'value',
    '#value' => $variation_set_name,
  );
  $form['variation_index'] = array(
    '#type' => 'value',
    '#value' => $variation_index,
  );
  if ($variation_index == 0) {
    $form['message'] = array(
      '#markup' => t('The control variation cannot be renamed.'),
    );
    return $form;
  }
  $form['confirm'] = array(
    '#prefix' => '<div>',
    '#suffix' => '</div>',
    '#markup' => t('Are you sure you want to delete %variation?', array(
      '%variation' => $variation_name,
    )),
  );
  $form['actions']['submit_form'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => array(
        'action-item-primary-active',
        'acquia-lift-submit-button',
      ),
    ),
    '#value' => t('Delete'),
  );
  $form['actions']['reset'] = array(
    '#markup' => ctools_ajax_text_button(t('Cancel'), 'admin/structure/acquia_lift/cancel/nojs', t('Cancel'), 'acquia-lift-cancel-button'),
  );
  return $form;
}