Guest User

Untitled

a guest
Aug 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. (function($, Drupal, drupalSettings, window, document) {
  2. Drupal.behaviors.worldmap = {
  3. attach(context, settings) {
  4. console.log('behaviors called');
  5. $('#map-container', context).once('addmap').each( () => {
  6. let map = new InteractiveMap('.interactive-map', (country) => {
  7. let id = settings.worldmap.yearsnids[country];
  8. if(!id) {
  9. id = 0;
  10. }
  11. console.log('id');
  12. let ajax_settings = {
  13. url: '/my_custom_module/ajax/expand/' +
  14. settings.worldmap.ctype + "-infobox/" + id,
  15. };
  16. Drupal.ajax(ajax_settings).execute();
  17. });
  18. map.init();
  19. });
  20. ...
  21.  
  22. <a href="/my_custom_module/ajax/expand/{{ fields.field_content_type.content|render|striptags|trim }}/{{ fields.nid.content|render|striptags|trim }}" class="button use-ajax">See the project</a>
Add Comment
Please, Sign In to add comment