You are here

function acquia_lift_page_variation_rename_form in Acquia Lift Connector 7

Form handler to generate a form to change a variation name.

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_rename_form'
acquia_lift_page_variation_rename_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a page variation rename modal window.

File

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

Code

function acquia_lift_page_variation_rename_form($form, &$form_state, $agent_name, $variation_index) {
  $variation_set_name = $agent_name;
  ctools_include('modal');
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  module_load_include('inc', 'acquia_lift', 'acquia_lift.page_variations');
  $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['variation_name'] = array(
    '#type' => 'textfield',
    '#title' => t('New name'),
    '#default_value' => acquia_lift_page_variation_get_name($agent_name, $agent_name, $variation_index),
    '#required' => TRUE,
    '#maxlength' => PERSONALIZE_MACHINE_NAME_MAXLENGTH,
  );
  $form['actions']['submit_form'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => array(
        'action-item-primary-active',
        'acquia-lift-submit-button',
      ),
    ),
    '#value' => t('Rename'),
  );
  $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;
}