0

I'm using jQuery UI Dialog from Drupal 8 core (jQuery UI Dialog 1.11.4) to show node in modal, but default options doesn't suits me and I need to change them.

To show node (node id 12 in this example) in modal I'm using this from Drupal:

<a class="use-ajax" data-dialog-type="modal" href="/node/12">SHOW NODE</a>

I tried to change defaults like this:

$.extend($.ui.dialog.prototype.options, {
            modal: true,
            width: '100%',
            height: '100%',
            fluid: true,
            resizable: false,
            closeText: Drupal.t('Close it'),
            hide: 'fadeOut',
            show: 'fadeIn'
          });

but I'm got empty modal with options I defined.

How I can just change these options and make it work?

1 Answer 1

1

You can add options to Dialog using "data-dialog-options" attribute. For example:

<a class="use-ajax" data-dialog-type="modal" data-dialog-options='{"width":"100%", "height":"100%", "fluid":"true", "resizable":"false", "hide":"fadeOut", "show":"fadeIn"}' href="/node/12">SHOW NODE</a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.