function ds_edit_view_mode_form_submit in Display Suite 7.2
Same name and namespace in other branches
- 7 ds.view_modes.inc \ds_edit_view_mode_form_submit()
Saves the view mode.
File
- modules/
ds_ui/ includes/ ds.view_modes.inc, line 163 - Administrative functions for managing view modes for every entity.
Code
function ds_edit_view_mode_form_submit($form, &$form_state) {
$view_mode = $form_state['view_mode'];
// Delete previous view_mode configuration (if any)
db_delete('ds_view_modes')
->condition('view_mode', $view_mode->view_mode)
->execute();
// Save the new view mode.
drupal_write_record('ds_view_modes', $view_mode);
// Clear entity info cache and trigger menu build on next request.
cache_clear_all('entity_info', 'cache', TRUE);
variable_set('menu_rebuild_needed', TRUE);
// Redirect.
$form_state['redirect'] = 'admin/structure/ds/view_modes';
drupal_set_message(t('The view mode %view_mode has been saved', array(
'%view_mode' => $view_mode->label,
)));
}