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.

CommentFileSizeAuthor
#5 2936360-field_name-constant-5.patch14.43 KBtim.plunkett

Comments

samuel.mortenson created an issue. See original summary.

tim.plunkett’s picture

# of occurrences, excluding tests:

$ ag layout_builder__layout --ignore-dir core/modules/layout_builder/tests | wc -l
       8

# of files, excluding tests

$ ag -l layout_builder__layout --ignore-dir core/modules/layout_builder/tests | wc -l
       3

# of occurrences, excluding tests:

$ ag "get\('layout_builder__layout" --ignore-dir core/modules/layout_builder/tests | wc -l
       3

# of files, excluding tests

$ ag -l "get\('layout_builder__layout" --ignore-dir core/modules/layout_builder/tests | wc -l
       2

The two?
\Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay, which adds and is responsible for the field
\Drupal\layout_builder\Routing\SectionStorageOverridesParamConverter, its corresponding param converter.

tim.plunkett’s picture

Component: layout.module » layout_builder.module

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new14.43 KB
johnwebdev’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

I think making it a constant on the interface is a better solution than an new method. Crediting @samuel.mortenson for creating the issue.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Backported 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!

  • alexpott committed a4c915a on 8.7.x
    Issue #2936360 by tim.plunkett, samuel.mortenson: Remove duplicate...

  • alexpott committed 7ae5538 on 8.6.x
    Issue #2936360 by tim.plunkett, samuel.mortenson: Remove duplicate...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.