function facetapi_facet_dependencies_form_submit in Facet API 6.3
Same name and namespace in other branches
- 7.2 facetapi.admin.inc \facetapi_facet_dependencies_form_submit()
- 7 facetapi.admin.inc \facetapi_facet_dependencies_form_submit()
Form submission handler for facetapi_facet_dependencies_form().
1 string reference to 'facetapi_facet_dependencies_form_submit'
- facetapi_facet_dependencies_form in ./
facetapi.admin.inc - Form constructor for the facet dependency settings form.
File
- ./
facetapi.admin.inc, line 1160 - Admin page callbacks for the Facet API module.
Code
function facetapi_facet_dependencies_form_submit($form, &$form_state) {
$success = TRUE;
// Pulls variables for code readability.
$adapter = $form['#facetapi']['adapter'];
$realm = $form['#facetapi']['realm'];
$settings = $form['#facetapi']['settings'];
$defaults = $form['#facetapi']['defaults'];
// Gets dependency settings from form.
$values = array_intersect_key($form_state['values'], $defaults);
$settings->settings['dependencies'] = $values + $defaults;
// Writes the settings to the database.
if (FALSE === ctools_export_crud_save('facetapi', $settings)) {
drupal_set_message(t('Error saving configuration options.'), 'error');
$success = FALSE;
}
// Sets message if both sets of configurations were saved.
if ($success) {
drupal_set_message(t('The configuration options have been saved.'));
}
// Redirects back to the realm settings page if necessary.
$clicked = $form_state['clicked_button']['#value'];
if (t('Save and go back to realm settings') == $clicked) {
$form_state['redirect'] = $adapter
->getPath($realm['name']);
}
}