Skip to main content
added 658 characters in body
Source Link
user106880
user106880

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

You try need to replace the used library core/jquery.cookie to core/js-cookie.

my_module.libraries.yml

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

js/my_library.es6.js

(($, Drupal, drupalSettings, CKEDITOR, cookies) => {
  Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
      cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const cutest = 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'));
    },
  };
})(jQuery,Drupal, drupalSettings, CKEDITOR,window.Cookies));

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

You try need to replace the used library core/jquery.cookie to core/js-cookie.

my_module.libraries.yml

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

js/my_library.es6.js

((Drupal, cookies) => {
  Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
      cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const cutest = 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'));
    },
  };
})(Drupal, window.Cookies);

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

You try need to replace the used library core/jquery.cookie to core/js-cookie.

my_module.libraries.yml

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

js/my_library.es6.js

(($, Drupal, drupalSettings, CKEDITOR, cookies) => {
  Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
      cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const cutest = 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'));
    },
  };
})(jQuery,Drupal, drupalSettings, CKEDITOR,window.Cookies));

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

added 658 characters in body
Source Link
user106880
user106880

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

. . and attach You try need to replace the used library core/jquery.cookie to a form using the following hook_form_alter implementation:core/js-cookie.

my_module.libraries.yml

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

js/my_library.es6.js

(&$form(Drupal, &$form_state,cookies) $form_id=> {
  Drupal.behaviors.myModule = {
    attach: () => {
  $form['#attached']['library'][]    // Set a cookie.
      cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const cutest = 'corecookies.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';cookie 3.0.0.
      cookies.set('cutest', JSON.stringify({ animal: 'red panda' }));
      const cutest = JSON.parse(cookies.get('cutest'));
    },
  };
})(Drupal, window.Cookies);

You try need to replace the used library core/jquery.cookie to core/js-cookie.

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

. . and attach the library to a form using the following hook_form_alter implementation:

function my_module_form_alter(&$form, &$form_state, $form_id) {
  $form['#attached']['library'][] = 'core/js-cookie';
}

You try need to replace the used library core/jquery.cookie to core/js-cookie.

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

You try need to replace the used library core/jquery.cookie to core/js-cookie.

my_module.libraries.yml

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

js/my_library.es6.js

((Drupal, cookies) => {
  Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
      cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const cutest = 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'));
    },
  };
})(Drupal, window.Cookies);

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

added 44 characters in body
Source Link
user106880
user106880

You try need to replace the usedI think you should delete these lines from your library core/jquery.cookie to core/js-cookie.

my_module.librariesfile.yml

my_libraryjs-cookie:
  js:
    libraries/asset-packagist/js-cookie/my_library.dist/js.cookie.min.mjs: {}
  dependencies:
    - core/drupaljquery
    - core/js-cookiedrupalSettings

js/my_cookie.js . and attach the library to a form using the following hook_form_alter implementation:

((Drupal, cookies) => {
  Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
     function cookies.setmy_module_form_alter('cutest'&$form, 'red&$form_state, panda'$form_id);
      // Retrieve a cookie.{
      const cutest$form['#attached']['library'][] = cookies.get('cutest');
      // Remove a cookie.
      cookies.remove('cutest');
      /'core/ 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'));
    },cookie';
  };
    })(Drupal, window.Cookies);

You try need to replace the used library core/jquery.cookie to core/js-cookie.

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

You try need to replace the used library core/jquery.cookie to core/js-cookie.

my_module.libraries.yml

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

js/my_cookie.js

((Drupal, cookies) => {
  Drupal.behaviors.myModule = {
    attach: () => {
      // Set a cookie.
      cookies.set('cutest', 'red panda');
      // Retrieve a cookie.
      const cutest = 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'));
    },
  };
    })(Drupal, window.Cookies);

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

I think you should delete these lines from your library file.

js-cookie:
  js:
    libraries/asset-packagist/js-cookie/dist/js.cookie.min.mjs: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

. . and attach the library to a form using the following hook_form_alter implementation:

function my_module_form_alter(&$form, &$form_state, $form_id) {
  $form['#attached']['library'][] = 'core/js-cookie';
}

You try need to replace the used library core/jquery.cookie to core/js-cookie.

Here is the official documentation with an anchor to the part that explain how to use js-cookie: https://www.drupal.org/node/3104677

added 44 characters in body
Source Link
user106880
user106880
Loading
Source Link
user106880
user106880
Loading