0

The dependency core/jquery.ui is not loading into the theme. jQuery is loaded as it is included by default but jquery.ui refuses to load.


#theme.libraries.yml
popup:
  version: 1.x
  js:
    js/popup.js: {}
  dependancies:
    - core/jquery
    - core/jquery.ui
#theme.info.yml

libraries:
  - theme/popup

I have also tried attaching the library using the code below, but still no luck.

// theme.theme
function theme_page_attachments_alter(&$page) {
  $route = \Drupal::routeMatch()->getRouteObject();
  $is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);
  if(!$is_admin) {
    $page['#attached']['library'][] = 'theme/popup';
  }
}

I have seen multiple references to core/jquery.ui throughout drupals files. So am a little confused.

I feel like i must be missing something obvious.

jQuery UI will load in fine if you are logged in, but again i believe this is included by default for admin users.

2 Answers 2

0

For those that are trying to use the built in jquery ui you must include -core/drupal.dialog as a dependency in your theme.libraries.yml for it to work

0

You made a typo in your theme.libraries.yml, dependancies should be dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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