Compatibility with layout_library module

Created on 19 July 2024, 4 months ago

Problem/Motivation

Right now , this module and Layout Library are incompatible, as Layout Library layouts are "entity-less", and this causes this code to fail since $layout_entity is NULL

    $layout_entity = $this->sectionStorage->getContextValue('entity');

    $entity_values = [
      'label' => $form_state->getValue('label'),
      'layout_section' => $deep_cloned_sections,
      'type' => 'template',
      'entity_type' => $layout_entity->getEntityTypeId(),
      'entity_id' => $layout_entity->id(),
    ];

I have done a quick search for the usages of the entity_id and entity_type fields and seems they are not very used. This leads me to think that maybe with a few alterations this module could support the Layout Library module. Entity Type can be read from the layout library config, while the ID might be not necessarily required.

Steps to reproduce

- Try to export a Section from within a Layout Library context
- Fail!

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Needs review

Version

1.1

Component

Code

Created by

🇪🇸Spain idiaz.roncero Madrid

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

Merge Requests

Comments & Activities

  • Issue created by @idiaz.roncero
  • 🇪🇸Spain idiaz.roncero Madrid

    Created a MR that makes the module compatible with Layout Library.

    It includes an important data model change - making the "entity_id" not required.

    I'm manually testing, the change, for now it works correctly. Still pending automated tests and a review by module maintainers to see if this functionality is wanted and what implications could have the missing "entity_id" value.

    But, if anybody needs to support layout_library right now, the MR works.

  • Status changed to Needs review 4 months ago
Production build 0.71.5 2024