You are here

function panels_common_settings_submit in Panels 7.3

Same name and namespace in other branches
  1. 5.2 includes/common.inc \panels_common_settings_submit()
  2. 6.3 includes/common.inc \panels_common_settings_submit()
  3. 6.2 includes/common.inc \panels_common_settings_submit()

Submit hook for panels_common_settings.

File

includes/common.inc, line 350
Functions used by more than one panels client module.

Code

function panels_common_settings_submit($form, &$form_state) {
  panels_common_allowed_layouts_form_submit($form, $form_state);
  $module_name = $form_state['values']['module_name'];
  variable_set($module_name . '_default', $form_state['values']['panels_common_default']);
  if (!$form_state['skip']) {

    // Merge the broken apart array neatly back together.
    $allowed_content_types = array();
    foreach ($form_state['values']['allowed'] as $allowed) {
      $values = $form_state['values']['content_types'][$allowed]['options'];

      // If new content of the type is not added, storing a lisy of disabled
      // content is not needed.
      if (!$form_state['values']['panels_common_default'][$allowed]) {
        $values = array_filter($values);
      }
      $allowed_content_types = array_merge($allowed_content_types, $values);
    }

    // Values from checkboxes are the same string as they key, but we only need
    // to store the boolean value.
    foreach ($allowed_content_types as &$value) {
      $value = (bool) $value;
    }
    variable_set($module_name . '_allowed_types', $allowed_content_types);
  }
  drupal_set_message(t('Your changes have been saved.'));
}