Warning: Undefined array key "caption" in Drupal\tablefield\Plugin\Field\FieldFormatter\TablefieldFormatter->viewElements() (line 150 of modules/contrib/tablefield/src/Plugin/Field/FieldFormatter/TablefieldFormatter.php).

Created on 12 December 2022, almost 2 years ago
Updated 9 May 2023, over 1 year ago

Under PHP 8.1 in Drupal 9.4 I have a Table Field on a content type that has its display managed by Layout Builder. The Table Field field has been placed in the layout and shows up using the "Tabular View" formatter.

When I go to Layout Builder I now see the following warning:

Warning: Undefined array key "caption" in Drupal\tablefield\Plugin\Field\FieldFormatter\TablefieldFormatter->viewElements() (line 150 of modules/contrib/tablefield/src/Plugin/Field/FieldFormatter/TablefieldFormatter.php).
Drupal\tablefield\Plugin\Field\FieldFormatter\TablefieldFormatter->viewElements(Object, 'en') (Line: 89)
Drupal\Core\Field\FormatterBase->view(Object, 'en') (Line: 265)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 266)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple(Array) (Line: 223)
Drupal\Core\Entity\Entity\EntityViewDisplay->build(Object) (Line: 461)
Drupal\Core\Entity\EntityViewBuilder->viewField(Object, Array) (Line: 243)
Drupal\Core\Field\FieldItemList->view(Array) (Line: 162)
Drupal\layout_builder\Plugin\Block\FieldBlock->build() (Line: 106)

Just checking isset($tabledata['caption']) seems like all we need here.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇨🇦Canada floydm

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024