Support InlineBlock block plugin

Created on 10 January 2021, almost 4 years ago
Updated 22 August 2024, 4 months ago

Problem/Motivation

As a site builder, I want to allow the creation of blocks on an entity, where these blocks will be single use. This is similar to adding blocks in layout_builder and the block type involved is InlineBlock. This issue is not about using layout builder though, it happens that layout builder provides the InlineBlock plugin.

I've added a general question about my problem on stack exchange as well.

Steps to reproduce

  1. Install block_field, layout_builder
  2. Create a custom block type with one field, just some text
  3. (Do not create any blocks in the custom block library)
  4. New node type "page"
  5. Add a block_field field to "page", and reference the new plugin, which will be type "inline block" (provider is Layout Builder)
  6. Create a node, populate by choose the block type and filling in the form.
  7. Hit save

Resulting error :

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\Component\Utility\NestedArray::getValue() must be of the type array, null given, called in /app/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 414 in Drupal\Component\Utility\NestedArray::getValue() (line 69 of core/lib/Drupal/Component/Utility/NestedArray.php).
Drupal\Component\Utility\NestedArray::getValue(NULL, NULL) (Line: 414)
Drupal\Core\Field\WidgetBase->flagErrors(Object, Object, Array, Object) (Line: 265)
Drupal\Core\Entity\Entity\EntityFormDisplay->flagWidgetsErrorsFromViolations(Object, Array, Object) (Line: 252)
Drupal\Core\Entity\Entity\EntityFormDisplay->validateFormValues(Object, Array, Object) (Line: 181)
Drupal\layout_builder\Plugin\Block\InlineBlock->blockValidate(Array, Object) (Line: 207)
Drupal\Core\Block\BlockBase->validateConfigurationForm(Array, Object) (Line: 238)
Drupal\block_field\Plugin\Field\FieldWidget\BlockFieldWidget::validate(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 280)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_article_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('node_article_form', Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('node_article_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

It would be great if this module supported the core "InlineBlock" block plugin type.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇦🇺Australia sime Melbourne

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Same problem, you cannot use online blocks because when saving the following error appears:

    The website encountered an unexpected error. Try again later.
    TypeError: Drupal\Component\Utility\NestedArray::getValue(): Argument #1 ($array) must be of type array, null given, called in /var/www/example.com/core/lib/Drupal/Core/Field/WidgetBase.php on line 531 in Drupal\Component\Utility\NestedArray::getValue() (line 69 of core/lib/Drupal/Component/Utility/NestedArray.php).
    Drupal\Core\Field\WidgetBase->flagErrors() (Line: 277)
    Drupal\Core\Entity\Entity\EntityFormDisplay->flagWidgetsErrorsFromViolations() (Line: 264)
    Drupal\Core\Entity\Entity\EntityFormDisplay->validateFormValues() (Line: 182)
    Drupal\layout_builder\Plugin\Block\InlineBlock->blockValidate() (Line: 211)
    Drupal\Core\Block\BlockBase->validateConfigurationForm() (Line: 249)
    Drupal\block_field\Plugin\Field\FieldWidget\BlockFieldWidget::validate()
    call_user_func_array() (Line: 281)
    Drupal\Core\Form\FormValidator->doValidateForm() (Line: 238)
    Drupal\Core\Form\FormValidator->doValidateForm() (Line: 238)
    Drupal\Core\Form\FormValidator->doValidateForm() (Line: 238)
    Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
    Drupal\Core\Form\FormValidator->validateForm() (Line: 593)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
    Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

  • The error that I explained in comment #8 led me here 🐛 Argument #1 ($values) must be of type array, null given. Postponed: needs info to apply the patch and if there is any problem with the layout builder

Production build 0.71.5 2024