You are here

function acquia_lift_goal_delete_form in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift.admin.unibar.inc \acquia_lift_goal_delete_form()

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

This form is called within a ctools modal window.

Parameters

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

string $action_name: The machine name for the visitor action for the goal.

1 string reference to 'acquia_lift_goal_delete_form'
acquia_lift_goal_delete_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a goal delete confirm modal window.

File

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

Code

function acquia_lift_goal_delete_form($form, &$form_state, $agent_name, $action_name) {
  ctools_include('modal');
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  $form = array();

  // Will only load if this is a custom action (not defined in code).
  $action = visitor_actions_custom_load($action_name);
  $form['agent_name'] = array(
    '#type' => 'value',
    '#value' => $agent_name,
  );
  $form['action_name'] = array(
    '#type' => 'value',
    '#value' => $action_name,
  );
  $form['confirm'] = array(
    '#prefix' => '<div>',
    '#suffix' => '</div>',
    '#markup' => t('Are you sure you want to delete %goal?', array(
      '%goal' => isset($action['label']) ? $action['label'] : $action_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;
}