You are here

function acquia_lift_campaign_start_form in Acquia Lift Connector 7

Form handler to start a new campaign.

Parameters

stdClass $agent_data: The data for the agent to start.

1 string reference to 'acquia_lift_campaign_start_form'
acquia_lift_campaign_start_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a start campaign screen.

File

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

Code

function acquia_lift_campaign_start_form($form, &$form_state, $agent_data) {
  ctools_include('modal');
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  $form['agent'] = array(
    '#type' => 'value',
    '#value' => $agent_data,
  );
  $form['adaptive'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically determine a winner'),
    '#description' => t('Acquia Lift will adapt to visitors to choose the best option over time.'),
    '#default_value' => $agent_data->data['decision_style'] == 'adaptive',
  );
  module_load_include('inc', 'personalize', 'personalize.admin');
  $form['campaign_dates'] = personalize_agent_date_form($agent_data->machine_name);

  // Rather than "Start manually", the option is really to start it now since
  // the user has triggered this via a "start campaign" form.
  $form['campaign_dates']['campaign_start']['#options']['none'] = t('Start now');
  $form['actions']['submit_form'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => array(
        'action-item-primary-active',
        'acquia-lift-submit-button',
      ),
    ),
    '#value' => t('Start campaign'),
  );
  $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;
}