Problem/Motivation
#3432874: Replace "Expose all fields as blocks to Layout Builder" configuration with a feature flag module makes it so that block plugins for fields are not created unless at least one bundle from an entity type has a layout builder entity view display enabled.
When enabling layout builder on an entity view display for the first time, layout builder creates the default layout and places block plugins for each field on the display. This generates warnings like this in the logs:
The "field_block:taxonomy_term:test:description" was not found
This is coming from BlockManager::handlePluginNotFound.
Nothing breaks and things work as expected, but these log messages can be alarming.
Steps to reproduce
- Turn on dblog
- Enable layout builder module
- Enable layout builder for an entity view display for one of the default content types. Note the content type's existing traditional entity view display must have at least one field set to be displayed already.
- Look at dblog report and see the warning messages
or
drush si --yes demo_umami- Observe warnings like 'The "field_block:node:page:body" was not found' and 'The "extra_field_block:node:page:links" was not found'.
Proposed resolution
Not sure. But I suspect we need to invalidate the block plugin cache somewhere between enabling layout builder view display and layout builder placing the field block plugins in a layout.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3478773
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
Comment #2
quietone commentedComment #3
penyaskitoThis might not be only entity view displays, but any entity using layout builder.
See #3488796: [warning] The "system_menu_block:welcome" block plugin was not found. Easiest way to reproduce is
ddev drush si --yes demo_umamiComment #4
kristen polGiven this will affect Drupal CMS until we switch to XB and it makes the system look buggy, can we figure out a way to try to suppress these somehow soon? Even a hacky way?
#3495181: "Block plugin not found" warnings during install
Comment #5
kristen polComment #7
phenaproximaI wrote a test for this and found the cause -- the issue is the
parent::preSave()call in\Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::preSave(), which invokes some inline block-related logic (specifically,\Drupal\layout_builder\Hook\LayoutBuilderHooks::entityPresave()) that expects all the block plugins in the section list to be instantiate-able, but the errant field block is not defined yet, because the block cache seemingly hasn't been cleared.Except that it has been cleared. LB clears it whenever a field is created (in
\Drupal\layout_builder\Hook\LayoutBuilderHooks::fieldConfigInsert()), which my test is very explicitly doing. You'd expect that would cause the block to become available right away...but you'd be wrong, because\Drupal\layout_builder\Plugin\Derivative\FieldBlockDeriver::getFieldMap()is only exposing fields used by entity view displays that are using Layout Builder. The problem is...the view display hasn't been saved yet; we're still in the middle of pre-saving it!So I think that's the problem right there. I'm not sure what the correct solution is here because this is some rather loopy, self-reflexive logic. But at least we have a test now so we'll know we fixed it.
Comment #9
tim.plunkettComment #10
benjifisherI am adding the STR from Comment #3 to the issue summary. I have noticed the same thing.
Comment #11
chandeepkhosa commented@kristen pol
I agree this would be really great to be fixed soon, as this could scare off less experienced developers looking at Drupal and Drupal CMS for the first time, and they will think that something has gone wrong.
In case it is helpful, here is the output from a fresh site install of Drupal CMS 1.1.0 (which in turn uses drupal/core-recommended 11.1.6) using Pygmy for a site I am preparing to launch on lagoon/amazee.io