You are here

function ds_build_modes_matrix_submit in Display Suite 6.2

Same name and namespace in other branches
  1. 6.3 includes/ds.buildmodes.inc \ds_build_modes_matrix_submit()
  2. 6 includes/ds.buildmodes.inc \ds_build_modes_matrix_submit()

Submit build mode matrix form.

1 string reference to 'ds_build_modes_matrix_submit'
ds_buildmodes_matrix_form in includes/ds.buildmodes.inc
Build modes matrix form.

File

includes/ds.buildmodes.inc, line 314
Manage build modes.

Code

function ds_build_modes_matrix_submit($form, &$form_state) {
  $exclude_build_modes = array();
  foreach ($form['#types'] as $ckey => $type) {
    $global_exclude = FALSE;
    foreach ($form['#build_modes'] as $bkey => $mode) {

      // Global exclude.
      if ($bkey == 'ds_block_all') {
        $global_exclude = $form_state['values'][$ckey . '-' . $bkey];
        variable_set($form['#module'] . '_type_' . $ckey, $form_state['values'][$ckey . '-' . $bkey]);
        $exclude_build_modes[$ckey][$bkey] = $form_state['values'][$ckey . '-' . $bkey];
      }
      else {
        $value = $global_exclude == TRUE ? $form_state['values'][$ckey . '-' . $bkey . '-disabled'] : $form_state['values'][$ckey . '-' . $bkey];
        $exclude_build_modes[$ckey][$bkey] = $value;
      }
    }
  }
  variable_set($form['#module'] . '_buildmodes_exclude', $exclude_build_modes);
  drupal_set_message(t('Disable type/build mode settings have been saved.'));
  menu_rebuild();
  drupal_rebuild_theme_registry();
}