Hi, I noticed that the deprecated library "jQuery.once" is still being used in the module and causing the functionalities to break in Drupal 10.

TypeError: $panelizer_checkbox.once is not a function
at Object.attach (http://127.0.0.1:8080/modules/contrib/panelizer/js/panelizer-default-for...)
at http://127.0.0.1:8080/core/misc/drupal.js?v=10.0.7:166:24
at Array.forEach ()
at Drupal.attachBehaviors (http://127.0.0.1:8080/core/misc/drupal.js?v=10.0.7:162:34)
at http://127.0.0.1:8080/core/misc/drupal.init.js?v=10.0.7:32:12
at HTMLDocument.listener (http://127.0.0.1:8080/core/misc/drupal.init.js?v=10.0.7:20:7)

Issue fork panelizer-3352704

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sker101 created an issue. See original summary.

sker101’s picture

here's a patch that replaces the jQuery once with the new once library from core.

sker101’s picture

StatusFileSize
new16.68 KB

Not sure if it's worth but hopefully this patch could address most of the tests.

There are two functional javascript tests that might fail due to upstream issue from Panels module

See https://www.drupal.org/project/panels/issues/3352958#comment-15002421

mingsong’s picture

Thanks @Shen for the patch.

May I ask a question about the access check in following codes?

 
   /** @var \Drupal\panelizer\Plugin\PanelizerEntityManager $panelizer_manager */
   $panelizer_manager = \Drupal::service('plugin.manager.panelizer_entity');
@@ -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();

Do we need to check the access in this case?

sker101’s picture

@Mingsong
I believe not because this query is triggered during a "post_udpate" hook.
I added the `accessCheck` method because it's required in Drupal 10.

mingsong’s picture

Thanks @Shen.

hamzadwaya made their first commit to this issue’s fork.

joseph.olstad’s picture

Status: Active » Reviewed & tested by the community

all of this looks good and is needed

codebymikey made their first commit to this issue’s fork.

jan kellermann’s picture

Thank you very much! I can confirm this patch also.

Notice for people who want to add this patch: Remove #3325442 before because it is included in this patch already.

damienmckenna’s picture

Assigned: sker101 » Unassigned
Parent issue: » #3393080: Plan for Panelizer 8.x-4.5

This looks good, thank you.

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thank you.

zanematthew’s picture

Note for others, patch does not apply and current 4.x version still produces various once errors in the console `$(...).once is not a function`.

joseph.olstad’s picture

@zanematthew, I'd say try the latest tagged release, no need for a patch now that it's released and included in the build, please rebuild your cache after upgrading to the latest release

composer require 'drupal/panelizer:^4.5'
This will get you 4.5 or newer, 4.5 being just released today.

zanematthew’s picture

@joseph.olstad I revisited this and it was another module causing the .once error. This update works as expected, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.