function facetapi_revert_form_submit in Facet API 6.3
Same name and namespace in other branches
- 7.2 facetapi.admin.inc \facetapi_revert_form_submit()
- 7 facetapi.admin.inc \facetapi_revert_form_submit()
Form submission handler for facetapi_revert_form_submit().
1 string reference to 'facetapi_revert_form_submit'
- facetapi_revert_form in ./
facetapi.admin.inc - Form constructor for the revert form.
File
- ./
facetapi.admin.inc, line 1279 - Admin page callbacks for the Facet API module.
Code
function facetapi_revert_form_submit($form, &$form_state) {
// Pulls variables for code readability.
$adapter = $form['#facetapi']['adapter'];
$realm = $form['#facetapi']['realm'];
$facet = $form['#facetapi']['facet'];
// Reverts per-facet display settings.
if ($form_state['values']['revert_facet']) {
$facet_settings = $adapter
->getFacetSettings($facet, $realm);
ctools_export_crud_delete('facetapi', $facet_settings);
}
// Reverts global settings if selected.
if ($form_state['values']['revert_global']) {
$global_settings = $adapter
->getFacetSettingsGlobal($facet);
ctools_export_crud_delete('facetapi', $global_settings);
}
// Sets message if both sets of configurations were saved.
drupal_set_message(t('The configuration options have been reverted.'));
$form_state['redirect'] = $adapter
->getPath($realm['name']);
}