Commit c243b3d6 authored by Jonathan Hedstrom's avatar Jonathan Hedstrom Committed by Jakob P
Browse files

Issue #2238025 by jhedstrom: Setting custom pane style with settings sets region style by accident

parent 1262db67
Loading
Loading
Loading
Loading
+5
Changes for js/display_editor.js: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -513,6 +513,11 @@ Drupal.behaviors.PanelsDisplayEditor = {
        $('#panels-preview').html(html);
      });

    // Bind modal detach behaviors to cancel current form.
    $(document).bind('CToolsDetachBehaviors', function(event, context) {
      $('#edit-cancel-style', context).trigger('click');
    });

    var setTitleClass = function () {
      if ($('#edit-display-title-hide-title').val() == 2) {
        $('#panels-dnd-main').removeClass('panels-set-title-hide');
+26
Changes for plugins/display_renderers/panels_renderer_editor.class.php: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1160,6 +1160,13 @@ class panels_renderer_editor extends panels_renderer_standard {
      unset($this->cache->style);
    }

    if (!empty($form_state['cancel'])) {
      // The cache must be saved prior to dismissing the modal.
      panels_edit_cache_set($this->cache);
      $this->commands[] = ctools_modal_command_dismiss();
      return;
    }

    // Copy settings from form state back into the cache.
    if(!empty($form_state['values']['settings'])) {
      if ($type == 'pane') {
@@ -1702,9 +1709,28 @@ function panels_edit_style_settings_form($form, &$form_state) {
    '#value' => t('Save'),
  );


  // Need a cancel button since the style cache can persist and impact the wrong
  // pane (or region, or display).
  $form['cancel_style'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#submit' => array('panels_edit_style_settings_form_cancel'),
  );

  return $form;
}

/**
 * Cancel style settings form.
 *
 * Clears the editing cache to prevent styles being applied to incorrect regions
 * or panes.
 */
function panels_edit_style_settings_form_cancel($form, &$form_state) {
  $form_state['cancel'] = TRUE;
}

/**
 * Validate style settings.
 */