Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The field name string "layout_builder__layout" is used throughout Layout Builder, which will make changing the field going forward difficult if a constant or other API reference to the name is not available.
$ grep layout_builder__layout -R core/modules/layout_builder/ | wc -l
18
Proposed resolution
Add a constant for the Layout Builder field name, or an API method to retrieve the field/field name from a given Entity.
Remaining tasks
Discuss possible solutions, write a patch.
User interface changes
Undecided.
API changes
Undecided.
Data model changes
Undecided.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2936360-field_name-constant-5.patch | 14.43 KB | tim.plunkett |
Comments
Comment #2
tim.plunkett# of occurrences, excluding tests:
# of files, excluding tests
# of occurrences, excluding tests:
# of files, excluding tests
The two?
\Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay, which adds and is responsible for the field
\Drupal\layout_builder\Routing\SectionStorageOverridesParamConverter, its corresponding param converter.
Comment #3
tim.plunkettComment #5
tim.plunkettComment #6
johnwebdev CreditAttribution: johnwebdev commentedComment #7
alexpottI think making it a constant on the interface is a better solution than an new method. Crediting @samuel.mortenson for creating the issue.
Comment #8
alexpottBackported to 8.6.x since layout_builder is still experimental.
Committed and pushed a4c915aaff to 8.7.x and 7ae55385d3 to 8.6.x. Thanks!