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.
Comment | File | Size | Author |
---|---|---|---|
#2 | ctools-entity_field_rendered_twice-2924356-2.patch | 1.47 KB | eyilmaz |
Comments
Comment #2
eyilmazFirst try.
Comment #3
eyilmazComment #4
eyilmazComment #6
eyilmazTests for 8.4 are passing, 8.5 tests are failing due to deprecation errors I think.
Comment #7
joseph.olstadwe've been using this for quite some time now
Comment #8
joseph.olstadtriggered some tests again, passes PHP 8.2, PHP 8.1, D10.0.x, D10.1.x
Comment #9
joseph.olstadpasses tests, we've been using this for quite some time already
Comment #10
joseph.olstadall branches