Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($, Drupal, drupalSettings, window, document) {
- Drupal.behaviors.worldmap = {
- attach(context, settings) {
- console.log('behaviors called');
- $('#map-container', context).once('addmap').each( () => {
- let map = new InteractiveMap('.interactive-map', (country) => {
- let id = settings.worldmap.yearsnids[country];
- if(!id) {
- id = 0;
- }
- console.log('id');
- let ajax_settings = {
- url: '/my_custom_module/ajax/expand/' +
- settings.worldmap.ctype + "-infobox/" + id,
- };
- Drupal.ajax(ajax_settings).execute();
- });
- map.init();
- });
- ...
- <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