Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion modules/distro/panelizer/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Panelizer 8.x-4.5, 2023-10-10
-----------------------------
#3288958 by Project Update Bot, DamienMcKenna: Drupal 10 compatibility fixes.
#3352704 by sker101, codebymikey, hamzadwaya, Mingsong, joseph.olstad, jan
kellermann, DamienMcKenna: Additional Drupal 10 compatibility fixes.


Panelizer 8.x-4.x-dev, xxxx-xx-xx
---------------------------------
#2889815 by samuel.mortenson: Fix tests for Panelizer 8.x.
Expand All @@ -9,7 +16,6 @@ Panelizer 8.x-4.x-dev, xxxx-xx-xx
#2912622 by gaydabura: Panelizer field should only show enabled view modes.
#2878095 by zuernBernhard: Panelizer Post Update fails in combination with
search_api index tracking.
#3288958 by Project Update Bot, DamienMcKenna: Drupal 10 compatibility fixes.


Panelizer 8.x-4.0, 2017-04-28
Expand Down
11 changes: 7 additions & 4 deletions modules/distro/panelizer/js/panelizer-default-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
* @file
* Javascript for the Panelizer defaults page.
*/
(function ($) {
(function ($, once) {
Drupal.behaviors.panelizer_default_form = {
attach: function (context, settings) {
var $panelizer_checkbox = $(':input[name="panelizer[enable]"]');
var $panelizer_checkbox = $(once('panelizer-default-form', 'input[name="panelizer[enable]"]', context));

if (!$panelizer_checkbox.length) {
return;
}
function update_form() {
var $core_form = $('#field-display-overview-wrapper');
if ($panelizer_checkbox.is(':checked')) {
Expand All @@ -17,8 +20,8 @@
}
}

$panelizer_checkbox.once('panelizer-default-form').click(update_form);
$panelizer_checkbox.click(update_form);
update_form();
}
};
})(jQuery);
})(jQuery, once);
6 changes: 3 additions & 3 deletions modules/distro/panelizer/panelizer.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- panels:panels
- panels:panels_ipe

# Information added by Drupal.org packaging script on 2022-08-23
version: '8.x-4.4+2-dev'
# Information added by Drupal.org packaging script on 2023-10-10
version: '8.x-4.5'
project: 'panelizer'
datestamp: 1661286213
datestamp: 1696975733
2 changes: 1 addition & 1 deletion modules/distro/panelizer/panelizer.install
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* default layouts.
*/
function panelizer_update_8401(&$sandbox) {
module_load_install('panels');
\Drupal::moduleHandler()->loadInclude('panels', 'install');
$config_factory = \Drupal::configFactory();
foreach ($config_factory->listAll('core.entity_view_display.') as $entity_display_name) {
$entity_display = $config_factory->getEditable($entity_display_name);
Expand Down
2 changes: 1 addition & 1 deletion modules/distro/panelizer/panelizer.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ panelizer_default_form:
js/panelizer-default-form.js: {}
dependencies:
- core/jquery
- core/jquery.once
- core/once
panels_ipe:
version: VERSION
js:
Expand Down
2 changes: 1 addition & 1 deletion modules/distro/panelizer/panelizer.module
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ function template_preprocess_panelizer_wizard_tree(&$variables) {
/** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */
$wizard = $variables['wizard'];
$cached_values = $variables['cached_values'];
$tree = $variables['tree'];
$tree = $variables['tree'] ?: [];
$variables['step'] = $wizard->getStep($cached_values);

foreach ($wizard->getOperations($cached_values) as $step => $operation) {
Expand Down
3 changes: 2 additions & 1 deletion modules/distro/panelizer/panelizer.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* default layouts.
*/
function panelizer_post_update_rename_layout_machine_names(&$sandbox) {
module_load_install('panels');
\Drupal::moduleHandler()->loadInclude('panels', 'install');

/** @var \Drupal\panelizer\Plugin\PanelizerEntityManager $panelizer_manager */
$panelizer_manager = \Drupal::service('plugin.manager.panelizer_entity');
Expand All @@ -31,6 +31,7 @@ function panelizer_post_update_rename_layout_machine_names(&$sandbox) {
$storage = \Drupal::entityTypeManager()->getStorage($entity_type);
$ids = $storage->getQuery()
->condition('panelizer', serialize([]), '<>')
->accessCheck(FALSE)
->execute();

foreach ($storage->loadMultiple($ids) as $entity_id => $entity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- panelizer:panelizer
- drupal:quickedit

# Information added by Drupal.org packaging script on 2022-08-23
version: '8.x-4.4+2-dev'
# Information added by Drupal.org packaging script on 2023-10-10
version: '8.x-4.5'
project: 'panelizer'
datestamp: 1661286213
datestamp: 1696975733
1 change: 1 addition & 0 deletions modules/distro/panelizer/src/Panelizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public function getEntityViewDisplay($entity_type_id, $bundle, $view_mode) {
$results = \Drupal::entityQuery('entity_view_display')
->condition('id', $candidate_ids)
->condition('status', TRUE)
->accessCheck()
->execute();

// Select the first valid candidate display, if any.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
type: module
name: Panelizer Test
description: 'Required for Panelizer simpletests only.'
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^8.8 || ^9 || ^10
dependencies:
- panelizer:panelizer

# Information added by Drupal.org packaging script on 2022-08-23
version: '8.x-4.4+2-dev'
# Information added by Drupal.org packaging script on 2023-10-10
version: '8.x-4.5'
project: 'panelizer'
datestamp: 1661286213
datestamp: 1696975733
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PanelizerDefaultsTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'bartik';
protected $defaultTheme = 'stark';

/**
* {@inheritdoc}
Expand Down Expand Up @@ -71,7 +71,7 @@ public function test() {
// default, they aren't.
$this->drupalGet('node/add/page');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->fieldValueNotEquals("panelizer['{$i}][default]", '');
$this->assertSession()->fieldNotExists("panelizer['{$i}][default]");
// Allow user to select panelized modes in UI.
$this->panelize('page', $view_mode_name, [
'panelizer[custom]' => TRUE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function createAdminUser(array $perms = array()) {
// From Panels.
'access panels in-place editing',
];
$this->verbose('<pre>' . print_r($perms, TRUE) . '</pre>');
dump('<pre>' . print_r($perms, TRUE) . '</pre>');
return $this->drupalCreateUser($perms);
}

Expand All @@ -111,7 +111,7 @@ public function testAdminUser() {
$matches = [];
if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $this->getSession()->getPage()->getContent(), $matches)) {
$drupalSettings = Json::decode($matches[1]);
$this->verbose('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
dump('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
}
$this->assertNotNull($drupalSettings);
if (!empty($drupalSettings)) {
Expand Down Expand Up @@ -158,7 +158,7 @@ public function testAdministerPanelizerPermission() {
$matches = [];
if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $this->getSession()->getPage()->getContent(), $matches)) {
$drupalSettings = Json::decode($matches[1]);
$this->verbose('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
dump('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
}
$this->assertNotNull($drupalSettings);
if (!empty($drupalSettings)) {
Expand Down Expand Up @@ -375,7 +375,7 @@ protected function setupPermissionTests(array $perms, $node = NULL) {
$matches = [];
if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $this->getSession()->getPage()->getContent(), $matches)) {
$drupalSettings = Json::decode($matches[1]);
$this->verbose('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
dump('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
}
return $drupalSettings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function testPanelizerDefault() {
$node = $this->drupalCreateNode(['type' => 'page']);
$out = $this->drupalGet('node/' . $node->id());
$this->assertSession()->statusCodeEquals(200);
$this->verbose($out);
dump($out);
$elements = $this->xpath('//*[@id="panels-ipe-content"]');
if (is_array($elements)) {
$this->assertSame(count($elements), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function testPanelizerDefault() {
]);
$out = $this->drupalGet('node/' . $node->id());
$this->assertSession()->statusCodeEquals(200);
$this->verbose($out);
dump($out);
$elements = $this->xpath('//*[@id="panels-ipe-content"]');
if (is_array($elements)) {
$this->assertSame(count($elements), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testPanelizerDefault() {

$out = $this->drupalGet('taxonomy/term/' . $term->id());
$this->assertSession()->statusCodeEquals(200);
$this->verbose($out);
dump($out);
$elements = $this->xpath('//*[@id="panels-ipe-content"]');
if (is_array($elements)) {
$this->assertSame(count($elements), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\Tests\panelizer\Functional;

use Drupal\Core\Url;
use Drupal\user\Entity\User;

/**
Expand Down Expand Up @@ -74,24 +75,27 @@ protected function createTestNode($type = 'page') {
* (optional) Additional form values.
*/
protected function panelize($content_type = 'page', $display = NULL, array $values = []) {
/** @var \Drupal\Tests\WebAssert $assert_sesion */
$assert_session = $this->assertSession();

$this->drupalGet("admin/structure/types");
$this->assertResponse(200);
$assert_session->statusCodeEquals(200);

$this->drupalGet("admin/structure/types/manage/{$content_type}");
$this->assertResponse(200);
$assert_session->statusCodeEquals(200);

$path = "admin/structure/types/manage/{$content_type}/display";
if (!empty($display)) {
$path .= '/' . $display;
}
$this->drupalGet($path);
$this->assertResponse(200);
$assert_session->statusCodeEquals(200);

$edit = [
'panelizer[enable]' => TRUE,
] + $values;
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertResponse(200);
$this->submitForm($edit, t('Save'));
$assert_session->statusCodeEquals(200);

\Drupal::service('entity_display.repository')->getFormDisplay('node', $content_type, 'default')
->setComponent('panelizer', [
Expand All @@ -114,14 +118,17 @@ protected function panelize($content_type = 'page', $display = NULL, array $valu
* (optional) Additional form values.
*/
protected function unpanelize($content_type = 'page', $display = NULL, array $values = []) {
/** @var \Drupal\Tests\WebAssert $assert_sesion */
$assert_session = $this->assertSession();

$this->drupalGet("admin/structure/types/manage/{$content_type}/display/{$display}");
$this->assertResponse(200);
$assert_session->statusCodeEquals(200);

$edit = [
'panelizer[enable]' => FALSE,
] + $values;
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertResponse(200);
$this->submitForm($edit, t('Save'));
$assert_session->statusCodeEquals(200);

\Drupal::service('entity_display.repository')->getFormDisplay('node', $content_type, 'default')
->removeComponent('panelizer')
Expand All @@ -136,6 +143,9 @@ protected function unpanelize($content_type = 'page', $display = NULL, array $va
* 'page'.
*/
protected function addPanelizerDefault($content_type = 'page', $display = 'default') {
/** @var \Drupal\Tests\WebAssert $assert_sesion */
$assert_session = $this->assertSession();

$label = $this->getRandomGenerator()->word(16);
$id = strtolower($label);
$default_id = "node__{$content_type}__{$display}__{$id}";
Expand All @@ -149,26 +159,27 @@ protected function addPanelizerDefault($content_type = 'page', $display = 'defau
$path .= '/' . $display;
}
$this->drupalGet($path);
$this->assertResponse(200);
$assert_session->statusCodeEquals(200);
$this->clickLink('Add a new Panelizer default display');

// Step 1: Enter the default's label and ID.
$edit = [
'id' => $id,
'label' => $label,
];
$this->drupalPostForm(NULL, $edit, t('Next'));
$this->assertResponse(200);
$this->submitForm($edit, t('Next'));
$assert_session->statusCodeEquals(200);

// Step 2: Define contexts.
$this->assertUrl("admin/structure/panelizer/add/{$default_id}/contexts", $options);
$this->drupalPostForm(NULL, [], t('Next'));
$this->assertResponse(200);

$assert_session->addressEquals(Url::fromUserInput("/admin/structure/panelizer/add/{$default_id}/contexts", $options)->toString());
$this->submitForm([], t('Next'));
$assert_session->statusCodeEquals(200);

// Step 3: Select layout.
$this->assertUrl("admin/structure/panelizer/add/{$default_id}/layout", $options);
$this->drupalPostForm(NULL, [], t('Next'));
$this->assertResponse(200);
$assert_session->addressEquals(Url::fromUserInput("/admin/structure/panelizer/add/{$default_id}/layout", $options)->toString());
$this->submitForm([], t('Next'));
$assert_session->statusCodeEquals(200);

// Step 4: If the layout has settings (new since Drupal 8.8), accept the
// defaults.
Expand All @@ -180,9 +191,9 @@ protected function addPanelizerDefault($content_type = 'page', $display = 'defau
}

// Step 5: Select content.
$this->assertUrl("admin/structure/panelizer/add/{$default_id}/content", $options);
$this->drupalPostForm(NULL, [], t('Finish'));
$this->assertResponse(200);
$assert_session->addressEquals(Url::fromUserInput("/admin/structure/panelizer/add/{$default_id}/content", $options)->toString());
$this->submitForm([], t('Finish'));
$assert_session->statusCodeEquals(200);

return $id;
}
Expand All @@ -199,10 +210,13 @@ protected function addPanelizerDefault($content_type = 'page', $display = 'defau
* (optional) The default ID.
*/
protected function deletePanelizerDefault($content_type = 'page', $display = 'default', $id = 'default') {
/** @var \Drupal\Tests\WebAssert $assert_sesion */
$assert_session = $this->assertSession();

$this->drupalGet("admin/structure/panelizer/delete/node__{$content_type}__{$display}__{$id}");
$this->assertResponse(200);
$this->drupalPostForm(NULL, [], t('Confirm'));
$this->assertResponse(200);
$assert_session->statusCodeEquals(200);
$this->submitForm([], t('Confirm'));
$assert_session->statusCodeEquals(200);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testPanelizerDefault() {
// Check the user entity page.
$out = $this->drupalGet('user/' . $account->id());
$this->assertSession()->statusCodeEquals(200);
$this->verbose($out);
dump($out);

// Verify that
$elements = $this->xpath('//*[@id="panels-ipe-content"]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PanelizerLayoutIDUpdateTest extends UpdatePathTestBase {
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
$this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz',
$this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/drupal-8.8.panelizer.minimal.php.gz',
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ protected function setUp(): void {
'access content',
'access panels in-place editing',
'administer blocks',
'administer content types',
'administer nodes',
'administer node display',
'administer panelizer',
'bypass node access',
]);
$this->drupalLogin($admin_user);

Expand Down