function acquia_lift_goal_type_create_form in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 acquia_lift.admin.unibar.inc \acquia_lift_goal_type_create_form()
Form builder function to create a new goal in the modal process of a specific type.
Parameters
type: The type of goal to create. Current supported choices: 'page', 'existing'
1 string reference to 'acquia_lift_goal_type_create_form'
- acquia_lift_goal_type_create_modal_callback in ./
acquia_lift.admin.unibar.inc - Page callback to generate the ctools modal form to create a goal of a specific type.
File
- ./
acquia_lift.admin.unibar.inc, line 1146 - acquia_lift.admin.unibar.inc
Code
function acquia_lift_goal_type_create_form($form, &$form_state, $type) {
ctools_include('modal');
ctools_include('ajax');
ctools_add_js('ajax-responder');
$agent_name = personalize_get_campaign_context();
$agent = personalize_agent_load($agent_name);
if (empty($agent)) {
$form['message'] = array(
'#markup' => t('You must select a campaign before adding goals.'),
);
return $form;
}
$form['agent'] = array(
'#type' => 'value',
'#value' => $agent,
);
$form['goal_type'] = array(
'#type' => 'value',
'#value' => $type,
);
$change_link = ctools_modal_text_button(t('Change type of goal'), 'admin/structure/acquia_lift/goal/add/nojs', t('Change type of test'), 'ctools-modal-acquia-lift-style');
// Add individual forms specific to the type of goal being created.
switch ($type) {
case 'existing':
$form['goal_type_change'] = array(
'#markup' => theme('acquia_lift_create_type_change', array(
'type' => t('Pre-existing goal'),
'id' => 'acquia-lift-create-goal-existing',
'change_link' => $change_link,
)),
);
$form['goal'] = _acquia_lift_existing_goal_create_form($agent);
break;
case 'page':
$form['goal_type_change'] = array(
'#markup' => theme('acquia_lift_create_type_change', array(
'type' => t('Page goal'),
'id' => 'acquia-lift-create-goal-page',
'change_link' => $change_link,
)),
);
$form['goal'] = _acquia_lift_page_goal_create_form($agent);
break;
}
// Common actions.
$form['actions']['submit_form'] = array(
'#type' => 'submit',
'#attributes' => array(
'class' => array(
'action-item-primary-active',
'acquia-lift-submit-button',
),
),
'#value' => t('Add goal'),
);
$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;
}