Problem/Motivation

Access $mapping['field_meta_properties:_formatted']['destination'] in PatternOneForEachFormatter leads to a warning when "formatted" values is not mapped to any region.

  $mapping['field_meta_properties:_formatted']['destination'] !== '_hidden'

This leads to an "Warning: Trying to access array offset on value of type null"
"field_meta_properties:_formatted" seems to be stripped from configuration if it is not mapped. Not sure if this is the right behavior but I guess so to have more clear configuration.

Steps to reproduce

Map a field to pattern and set "_formatted" property to "_hidden" in layout builder.

Proposed resolution

Add a check.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Christian.wiedemann created an issue. See original summary.

tim-diels’s picture

Status: Active » Needs review

As there is a MR, the status should be on Needs Review. So changed status.

tim-diels’s picture

Status: Needs review » Reviewed & tested by the community

Got a similar error message when indexing (layout builder) content in search API.

Undefined array key "field_meta_properties:_formatted" PatternOneForEachFormatter.php:50

Didn't had time to further investigate. The MR fixed this.

DuaelFr made their first commit to this issue’s fork.

duaelfr’s picture

Status: Reviewed & tested by the community » Fixed

I had to merge by hand but it's done :)
Thanks!

duaelfr’s picture

Status: Fixed » Closed (fixed)

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