Layout Builder Lock, UI Styles Layout Builder and Section Library support

Created on 31 March 2023, over 1 year ago
Updated 3 May 2023, over 1 year ago

Problem/Motivation

Hi,

I am currently testing gin_lb. First, thanks a lot for this module!

My front theme is UI Suite Boostrap and admin theme is Gin (obviously).

I have commented out Ui Suite Bootstrap preprocess form element, input, etc, to ensure there is no effect.

(Out of scope: I think I will open a an issue in UI Suite Bootstrap to discuss optional support of Gin LB out of the box, currently doing support in a custom sub-theme to test.)

I have noticed that Layout Builder Lock and UI Styles Layout Builder options are not properly styled because outside of a Gin LB container. While Layout Options options are correctly handled.

I am also testing with Layout Builder Modal.

See attached screenshots.

Proposed resolution

All options should be styled properly.

Remaining tasks

Determine if this an additional support to do in Gin LB or if the problem comes form Layout Builder Lock and UI Styles Layout Builder.

💬 Support request
Status

Fixed

Version

1.0

Component

User interface

Created by

🇫🇷France Grimreaper France 🇫🇷

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

Comments & Activities

  • Issue created by @Grimreaper
  • 🇩🇪Germany Christian.wiedemann

    Hi @Grimreaper

    it is quite hard to separate admin and frontend theme. For that reason, I need to know if the form is gin lb form or frontend form.

    If the form should rendered as gin form use in your form (propably a hook would be bettter):

        $form['#after_build'][] = 'gin_lb_after_build';
        $form['#gin_lb_form'] = TRUE;
        $form['#attributes']['class'][] = 'glb-form';
    

    If the form controller should rendered as gin implement hook function

    hook_gin_lb_is_layout_builder_route_alter(&$gin_lb_is_layout_builder_route) {
      $route_match = \Drupal::routeMatch();
      $route_name = $route_match->getRouteName();
      if ($route_name === 'entity.page.add_step_form' && $route_match->getParameter('step') === 'layout_builder') {
        $gin_lb_is_layout_builder_route = TRUE;
      }
    }
    
  • 🇫🇷France Grimreaper France 🇫🇷

    Hi @Christian.wiedemann :),

    Those are not custom forms.

    Those are the configure section form and the configure block (an inline block content entity) form. So they are already handled by Gin LB, no problem.

    My question was about, why Layout Builder Lock and UI Styles Layout Builder fieldsets were not put inside the Gin LB container?

    If the reason is obvious for a maintainer, good, otherwise, I will search, don't worry :)

  • 🇫🇷France Grimreaper France 🇫🇷

    I think I found where it is done.

    In gin_lb_form_alter():

        if (isset($form['settings'])) {
          $form['settings']['#type'] = 'container';
          $form['settings']['#attributes']['class'][] = 'canvas-form__settings';
        }
    
        if (isset($form['layout_settings'])) {
          $form['layout_settings']['#type'] = 'container';
          $form['layout_settings']['#attributes']['class'][] = 'canvas-form__settings';
        }
    
        if (in_array($form_id, [
          'layout_builder_remove_block',
          'layout_builder_remove_section',
        ])) {
          $form['description']['#type'] = 'container';
          $form['description']['#attributes']['class'][] = 'canvas-form__settings';
        }
    
        $form['actions']['#type'] = 'container';
        $form['actions']['#attributes']['class'][] = 'canvas-form__actions';
    

    The type and class are changed/added manually to some specific $form direct children.

    I will try to poc something.

  • Assigned to Grimreaper
  • 🇫🇷France Grimreaper France 🇫🇷
  • 🇫🇷France Grimreaper France 🇫🇷
  • @grimreaper opened merge request.
  • 🇫🇷France Grimreaper France 🇫🇷

    Hi,

    MR created.

    Here is a patch for Composer usage.

    I have not touched existing code but is the syntax $form['description']['#attributes']['class'][] = 'canvas-form__settings'; ok with potentially existing attributes?

    Am I overcomplicating using NestedArray::mergeDeepArray([?

    Thanks for the review.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany Christian.wiedemann

    Thanks, I rebased your MR.

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024