- 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
- @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 6:43am 3 May 2023 -
Christian.wiedemann →
committed 7bf425d1 on 1.0.x authored by
Grimreaper →
Issue #3351493: Layout Builder Lock, UI Styles Layout Builder and...
-
Christian.wiedemann →
committed 7bf425d1 on 1.0.x authored by
Grimreaper →
- Status changed to Fixed
over 1 year ago 6:44am 3 May 2023 Automatically closed - issue fixed for 2 weeks with no activity.