Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Drupal: How to rewrite jQuery Cookie with Javascript Cookie

16/01/2024, by Ivan

Drupal 9 and above uses Javascript Cookie library instead of jQuery Cookie:

https://www.drupal.org/node/3104677

https://www.drupal.org/node/3322720

https://www.drupal.org/node/3296086

You can find a lot of patches for contrib modules, for example:

https://www.drupal.org/project/eu_cookie_compliance/issues/3194270

If you need to upgrade site to Drupal 10, you will need to replace jQuery Cookie library:
my_module.libraries.yml

my_library:
  js:
    js/my_library.js: {}
  dependencies:
    - core/jquery
    - core/jquery.cookie
    - core/drupal

with:

my_library:
  js:
    js/my_library.js: {}
  dependencies:
    - core/drupal
    - core/js-cookie

And update your javascript code:

 Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
      Cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const myCookieValue = Cookies.get('cutest');
      // Remove a cookie.
      Cookies.remove('cutest');
      // Store and retrieve as a JSON object. Use of the getJSON method should be avoided as that will be deprecated in js-cookie 3.0.0.
      Cookies.set('cutest', JSON.stringify({ animal: 'red panda' }));
      const cutest = JSON.parse(Cookies.get('cutest'));
    },
  };