0

I am trying to open a webform in a modal window through following link, which works fine when I am logged in, but when I logout it simply stops working

<a class="use-ajax" data-dialog-options="{&quot;width&quot;:600}" data-dialog-type="modal" href="/form/call-back">Get a Call Back</a>

It seems like we need to load ajax on pages where we want to use this link, so I want to know how can I load ajax sitewide.

0

Implement hook_page_attachments_alter() like so:

function MODULE_page_attachments_alter(array &$attachments) {
  $attachments['#attached']['library'][] = 'drupal.ajax';
}

The same hook can be implemented in a theme if that makes more sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.