Block entity_field renders entity field twice.

Created on 17 November 2017, over 6 years ago
Updated 14 June 2024, 11 days ago

Problem/Motivation

Using the block entity_field (Drupal\ctools_block\Plugin\Block\EntityField) causes creation of the render array twice due to the fact that the field->view is executed once in blockAccess() and once in build().

This is introduced in #2804165: Missing check for empty field when building ctools block .

This causes issues when an entity reference field to i.e. a webform is used, where validation and submissions are handled twice because the ->view function gets called twice.

Proposed resolution

Either reuse the created render array in build() again or use access() hook only for access and handle emptyness of fields somewhere else (in build() ?).

Remaining tasks

Implement solution.

🐛 Bug report
Status

RTBC

Version

4.1

Component

CTools Blocks

Created by

🇩🇪Germany eyilmaz Berlin, Germany

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

Merge Requests

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.69.0 2024