function acquia_lift_agent_delete_form_submit in Acquia Lift Connector 7.2
Submit handler for agent deletion form.
File
- ./
acquia_lift.admin.inc, line 639 - acquia_lift.admin.inc Provides functions needed for the admin UI.
Code
function acquia_lift_agent_delete_form_submit($form, &$form_state) {
$agent_name = $form_state['values']['machine_name'];
$agent_type = $form_state['values']['plugin'] == ACQUIA_LIFT_TESTING_AGENT ? 'test' : 'personalization';
// First delete all option sets belonging to the agent.
$option_sets = personalize_option_set_load_by_agent($agent_name);
foreach ($option_sets as $option_set) {
personalize_option_set_delete($option_set->osid);
}
personalize_agent_delete($form_state['values']['machine_name']);
drupal_set_message(t('The %agent %name has been deleted.', array(
'%agent' => $agent_type,
'%name' => $form_state['values']['title'],
)));
$form_state['redirect'] = 'admin/structure/personalize';
}