D9: Make the edit action of layout paragraphs open an iframe instead of dialog

Created on 12 December 2022, over 2 years ago
Updated 20 February 2023, about 2 years ago

Problem/Motivation

There is no alter hook for the builder controls, so it is impossible to change the edit dialog type.

Using an iframe lets us use the admin theme for editing content. This is achieved currently with a custom module.

Steps to reproduce

Try creating an alter function to edit the dialog type of the edit action. It's not doable.

Proposed resolution

Make the edit button use an iframe dialog with this patch to make layout_paragraphs_iframe_modal custom module work.

Remaining tasks

Make an alter hook for the layout_paragraphs_preprocess_layout_paragraphs_builder_controls function.

User interface changes

None

API changes

None

Data model changes

None

✨ Feature request
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica esteban.arias

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany stmh

    insteds of an alter hook you can inject it via the preprocess hook. So no changes needed to layout_paragraphs

    /**
     * Implements hook_preprocess_layout_paragraphs_builder().
     */
    function layout_paragraphs_iframe_modal_preprocess_layout_paragraphs_builder_controls(array &$variables) {
      foreach ($variables['controls'] as $ndx => $control) {
        if (!empty($control['#attributes']['data-dialog-type'])) {
          $variables['controls'][$ndx]['#attributes']['data-dialog-type'] = 'iframe';
        }
      }
    }
    
  • πŸ‡ΊπŸ‡ΈUnited States justin2pin

    See #5.

Production build 0.71.5 2024