function nd_display_submit in Node displays 6
Save fields per context.
1 string reference to 'nd_display_submit'
- nd_display_overview_form in includes/
nd.display.inc - Menu callback; presents a listing of fields display settings for a content type.
File
- includes/
nd.display.inc, line 130 - Display overview form.
Code
function nd_display_submit($form, &$form_state) {
$node_type = $form['#node_type'];
$build_mode = $form['#build_mode'];
// Exclude build mode checkbox.
$exclude_build_mode = $form_state['values']['exclude_build_mode'];
$exclude_build_modes = variable_get('nd_buildmodes_exclude', array());
$exclude_build_modes[$node_type][$build_mode] = $exclude_build_mode;
variable_set('nd_buildmodes_exclude', $exclude_build_modes);
$nd_display_settings = variable_get('nd_display_settings_' . $node_type, array());
unset($nd_display_settings[$build_mode]);
// Fields.
$fields = nd_get_fields($form['#node_type'], $form['#has_body'], $build_mode);
if (!empty($fields)) {
foreach ($fields as $key => $field) {
$nd_display_settings[$build_mode]['fields'][$key]['weight'] = $form_state['values'][$key]['nd_weight'];
$nd_display_settings[$build_mode]['fields'][$key]['format'] = $form_state['values'][$key][$build_mode]['format'];
$nd_display_settings[$build_mode]['fields'][$key]['region'] = $form_state['values'][$key][$build_mode]['region'];
$nd_display_settings[$build_mode]['fields'][$key]['labelformat'] = $form_state['values'][$key][$build_mode]['label']['format'];
// Ditch this field, unless it has its storage in another module (ie CCK)
if (!isset($field['storage'])) {
unset($form_state['values'][$key]);
}
}
}
// Plugins
if ($build_mode != NODE_BUILD_RSS) {
nd_plugins_display_submit($form, $form_state, $nd_display_settings);
}
// Save all these settings.
variable_set('nd_display_settings_' . $node_type, $nd_display_settings);
drupal_set_message(t('Your settings have been saved.'));
}