Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: RightUp 1.0.2 — Minor update available for module rightup (1.0.2). Release: CronWatch 0.12.1 — Minor update available for module cronwatch (0.12.1). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Dialog Tools

No security coverage
View on drupal.org

The Dialog Tools module provides a set of utilities that extends the dialog support present in Drupal 9+.

The primary use case for this module is to:

  • make it easy to display contents in an interactive overlay
  • extend existing features with a display in modal option

Usage

From a render array

You can display content in dialogs from render arrays in a declarative way.

  1. Attach the library dialog_tools/discover to your render array

    $build['#attached']['library'][] = 'dialog_tools/discover';

  2. Create the modal content, eg. in a container with the class name "dialog-tools-dialog"
      use Drupal\Component\Serialization\Json;
    
       $build['dialog']['#type'] = 'container';
       // The "dialog-tools-dialog" class makes the container being discovered and
       // initialized by Dialog Tools.
       $build['dialog']['#attributes']['class'][] = 'dialog-tools-dialog';
       // The "data-dialog-tools-button" attribute contains the ID of the opening
       // button element.
       $build['dialog']['#attributes']['data-dialog-tools-button'] = 'modal-open-button';
       // Some dialog options, see more at https://api.jqueryui.com/dialog/
       $build['dialog']['#attributes']['data-dialog-tools-options'] = Json::encode([
         'title' => t('Modal title'),
         'width' => '80%',
         'modal' => TRUE,
       ]);
    
       $build['dialog']['content'] = [
         '#markup' => t('Test!'),
       ];
    
  3. Add the modal opening button

       $build['modal_open_button'] = [
         '#type' => 'html_tag',
         '#tag' => 'button',
         '#value' => t('Open modal'),
         '#attributes' => [
           'type' => 'button',
           'id' => 'modal-open-button',
           'class' => ['button', 'button--primary'],
         ],
       ];
    

From views

Currently Dialog Tools enhace the operations links views field with the ability
to load and display link target content in a modal dialog. To do so, just enable
de option "Open links in modal" in the operations field setting. It can be
enabled only to some particular links by entering their IDs in an additional
configuration option.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Nov 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.x-dev Dev Nov 8, 2023