You are here

function layout_responsive_settings_form_submit in Layout 7

Form submission. Process the changes to the layout.

1 string reference to 'layout_responsive_settings_form_submit'
responsive.inc in plugins/layouts/responsive.inc

File

plugins/layouts/responsive.inc, line 68

Code

function layout_responsive_settings_form_submit(&$layout_settings, $display, $layout, $old_layout_settings) {
  $default_regions = layout_region_load_all();
  $new_layout_settings = drupal_json_decode($layout_settings['layout_responsive_regions']);
  if (!empty($new_layout_settings)) {
    foreach ($new_layout_settings['regions'] as $region) {
      $layout_settings['regions'][$region['name']] = $region['name'];

      // Save region in common regions list in case it is new.
      if (!isset($default_regions[$region['name']])) {
        $region = (object) array(
          'name' => $region['name'],
          'admin_title' => $region['admin_title'],
        );
        layout_region_save($region);
      }
    }
    $layout_settings['overrides'] = $new_layout_settings['overrides'];
  }

  // Clean out this value that was only used for communication, so it is not
  // saved with the layout.
  unset($layout_settings['layout_responsive_regions']);
}