function habitat_ui_settings_submit in Habitat 7
1 string reference to 'habitat_ui_settings_submit'
- habitat_ui_settings in habitat_ui/
habitat_ui.module - Page callback. Settings page.
File
- habitat_ui/
habitat_ui.module, line 71 - User Interface for Habitat.
Code
function habitat_ui_settings_submit($form, &$form_state) {
$form_state['values']['habitat_habitats'] = explode("\n", $form_state['values']['habitat_habitats']);
foreach ($form_state['values']['habitat_habitats'] as &$habitat) {
$habitat = trim($habitat);
$form_state['values'] = habitat_ui_settings_module_values($form_state['values'], 'habitat_enable_' . $habitat);
$form_state['values'] = habitat_ui_settings_module_values($form_state['values'], 'habitat_disable_' . $habitat);
}
// Delete any stale settings.
$variables = db_select('variable', 'v')
->fields('v', array(
'name',
))
->condition('name', db_like("habitat_enable_") . '%', 'LIKE')
->execute()
->fetchCol();
foreach ($variables as $variable) {
if (!in_array(substr($variable, 15), $form_state['values']['habitat_habitats'])) {
variable_del($variable);
}
}
$variables = db_select('variable', 'v')
->fields('v', array(
'name',
))
->condition('name', db_like("habitat_disable_") . '%', 'LIKE')
->execute()
->fetchCol();
foreach ($variables as $variable) {
if (!in_array(substr($variable, 16), $form_state['values']['habitat_habitats'])) {
variable_del($variable);
}
}
}