## Problem
`Drupal\formblock\Plugin\Block\NodeFormBlock::blockAccess()` calls `NodeType::load($this->configuration['type'])` without checking that `type` is set. When the block is instantiated without a node type in its configuration (which can happen when something tries to enumerate or pre-flight-check available blocks), `NodeType::load(NULL)` propagates NULL into `EntityStorageBase::loadMultiple([NULL])`, which calls `array_flip([NULL])` and emits the warning:
```
Warning: array_flip(): Can only flip string and integer values, entry skipped in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 283 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
```
In our case the warning is emitted on every page render of the homepage, with this stack trace originating from a third-party module (DXPR Builder) calling `\Drupal::service('plugin.manager.block')->createInstance($block_id, [])` and then `$block->access()` to discover available blocks.
## Stack trace excerpt
```
#0 [internal function]: _drupal_error_handler()
#1 core/lib/Drupal/Core/Entity/EntityStorageBase.php(283): array_flip()
#2 core/lib/Drupal/Core/Entity/EntityStorageBase.php(267): EntityStorageBase->loadMultiple()
#3 core/lib/Drupal/Core/Entity/EntityBase.php(528): EntityStorageBase->load()
#4 modules/contrib/formblock/src/Plugin/Block/NodeFormBlock.php(208): EntityBase::load()
#5 core/lib/Drupal/Core/Block/BlockPluginTrait.php(127): BlockBase->access()
```
## Proposed fix
Short-circuit `blockAccess()` to `AccessResult::forbidden()` when no `type` is configured. A block with no node type is never usable for rendering anyway, so denying access is the semantically correct answer and it silences the warning.
## Patch
A merge request will be linked from this issue.
## Environment
Reproduced on Drupal 11.3.5 with formblock 2.0.x-dev. Site uses DXPR Builder 2.x which enumerates blocks for its element discovery flow.
Issue fork formblock-3584704
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 #3
jurriaanroelofs commentedMerge request !6 is ready for review.