settings.dialog is undefined with modal form

Created on 6 September 2023, over 1 year ago

Problem/Motivation

I want to open a modal form into a standard form. I setup a link to open the modal.

  $form['actions']['suspend'] = [
    '#type' => 'link',
    '#title' => t('Save Cart'),
    '#url' => Url::fromRoute('oto_commerce_cart_suspended.suspended_form'),
    '#attributes' => [
      'class' => [
        'use-ajax',
        'button',
        'btn btn-primary'
      ],
    ],
    '#weight' => 100
  ];

  // Attach the library for pop-up dialogs/modals.
  $form['#attached']['library'][] = 'core/drupal.dialog.ajax';

When i try my code into gin theme i don't have problem. code works fine.
When i try to use into frontend theme i get this error:

Uncaught TypeError: settings.dialog is undefined
    attach https://localhost/core/misc/dialog/dialog.ajax.js?v=9.5.10:21
    attachBehaviors https://localhost/core/misc/drupal.js?v=9.5.10:24
    attachBehaviors https://localhost/core/misc/drupal.js?v=9.5.10:21
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.5.10:24
    listener https://localhost/core/misc/drupal.init.js?v=9.5.10:14
    domReady https://localhost/core/misc/drupal.init.js?v=9.5.10:20
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.5.10:23
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.5.10:26

what is missing?
Thank you

💬 Support request
Status

Active

Version

9.5

Component
Ajax 

Last updated about 1 hour ago

Created by

🇮🇹Italy trickfun

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @trickfun
  • Status changed to Closed: outdated 2 months ago
  • 🇳🇿New Zealand quietone

    @trickfun, as you can see by the lack of responses here the Drupal Core issue queue is not the ideal place for support requests. The 'support request' option is there for filing support issues for contributed modules and themes. There are several support options listed on our Support page . This is 'Get Support' at the top of Drupal.org. There is also information about Drupal Slack , at 'Get Support -> Drupal Slack' also at the top of Drupal.org. You may get better replies in one of those places.

    Cheers

Production build 0.71.5 2024