In Drupal 11, when a content field (e.g., a "Body" field managed by CKEditor 5) contains an embedded block (e.g., a Views block displaying recent articles), and this content is exposed via a Views REST Export display, the JSON output returns <drupal-render-placeholder>
tags instead of the rendered HTML for the embedded block.
For example, if a basic page's body field embeds a "Recent Articles" Views block, accessing a REST endpoint for that basic page will show a placeholder like this:
<div data-entity-type="block" ... class="embedded-entity"><drupal-render-placeholder callback="Drupal\\block\\BlockViewBuilder::lazyBuilder" arguments="..." token="..."></drupal-render-placeholder></div>
This issue prevents decoupled frontends or other API clients from consuming the actual content of embedded blocks, as they receive unrendered placeholder tags. The same content, when viewed in the Drupal UI (e.g., in the Views preview or on the basic page itself), correctly renders the embedded block's HTML.
This behavior is observed in Drupal 11 (specifically D11.2.4) but was not present in Drupal 10.4.8, indicating a change in render placeholder handling within REST contexts.
entity_embed
module.<drupal-render-placeholder>
tag for the embedded Views block instead of the list of articles.The issue appears to stem from a specific line of code introduced or significantly altered in Drupal 11 within core/modules/block/src/BlockViewBuilder.php
.
Specifically, the following code snippet forces the creation of a render placeholder:
if ($plugin->createPlaceholder()) { $build[$entity_id] += [ '#create_placeholder' => TRUE, ]; }
When this conditional block is removed or commented out, the REST endpoint correctly returns the rendered HTML of the embedded block, resolving the issue for API consumers.
The attached patch implements this by commenting out the problematic lines in BlockViewBuilder.php
.
#create_placeholder => TRUE
by default in their render array during the `BlockViewBuilder::lazyBuilder` process. Modules or custom code explicitly checking for this render array property to trigger specific asynchronous rendering behaviors might be affected.Active
11.2 🔥
block.module
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.