function weight_settings_form_submit in Weight 7
Same name and namespace in other branches
- 6 weight.admin.inc \weight_settings_form_submit()
File
- ./
weight.admin.inc, line 83 - This module uses the sticky column of the node table to add weighting to nodes.
Code
function weight_settings_form_submit($form, &$form_state) {
variable_set('weight_range', $form_state['values']['weight_range']);
variable_set('weight_position', $form_state['values']['weight_position']);
variable_set('weight_default', $form_state['values']['weight_default']);
variable_set('weight_use_menu', $form_state['values']['weight_use_menu']);
variable_set('weight_label', $form_state['values']['weight_label']);
// Check for changes in the list.
$before = array_filter(variable_get('weight_node_types', array()));
$after = array_filter($form_state['values']['weight_node_types']);
$del = array_diff($before, $after);
$add = array_diff($after, $before);
// Add weighting to new types.
if ($add) {
weight_old_nodes($add);
}
// Remove weighting from types taken out of the list.
if ($del) {
weight_disable($del);
}
variable_set('weight_node_types', $after);
drupal_set_message(t('Settings updated.'));
}