When add new brick to entity and forget to save brick before saving entity we get this error:

ErrorException: Undefined index: entities
#32 modules/contrib/bricks/modules/bricks_inline/src/Plugin/Field/FieldWidget/BricksTreeInlineWidget.php(40): handleError
#31 modules/contrib/bricks/modules/bricks_inline/src/Plugin/Field/FieldWidget/BricksTreeInlineWidget.php(40): massageFormValues
#30 modules/contrib/inline_entity_form/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php(576): extractFormValues
#29 core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(222): extractFormValues
#28 core/lib/Drupal/Core/Entity/ContentEntityForm.php(307): copyFormValuesToEntity
#27 core/lib/Drupal/Core/Entity/EntityForm.php(291): buildEntity
#26 core/lib/Drupal/Core/Entity/ContentEntityForm.php(147): buildEntity
#25 core/lib/Drupal/Core/Entity/EntityForm.php(276): submitForm
#24 core/lib/Drupal/Core/Entity/ContentEntityForm.php(137): submitForm
#23 [Anonymous function](0): call_user_func_array
#22 core/lib/Drupal/Core/Form/FormSubmitter.php(111): executeSubmitHandlers
#21 core/lib/Drupal/Core/Form/FormSubmitter.php(51): doSubmitForm
#20 core/lib/Drupal/Core/Form/FormBuilder.php(585): processForm
#19 core/lib/Drupal/Core/Form/FormBuilder.php(314): buildForm
#18 core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): getForm
#17 core/modules/node/src/Controller/NodeController.php(113): add
#16 [Anonymous function](0): call_user_func_array

Steps to reproduce:

  1. Install bricks and eck modules
  2. Create a brick field with reference to created eck entity "Brick".
  3. Go to node creation
  4. Click "Add new brick"
  5. Fill required fields and don't click "Create brick"
  6. Click "Save and publish"

Expected: Warning message or clean save.
Actual: ErrorException

Here the image of case:
https://www.dropbox.com/s/5t2nnxlrztqofo1/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mitsuroseba created an issue. See original summary.

mitsuroseba’s picture

Status: Active » Needs review
FileSize
1.15 KB

Patch.

anydigital’s picture

Thanks for reporting, Valerii!

Can you please give a bit more info to reproduce the exact issue? I see a different log when trying this in my setup.

What is a "Banner", a node field, or something different?

mitsuroseba’s picture

Issue summary: View changes

Updated, description.

Banner is bricky field with reference to eck entity "slider" with bundle "slider_wrapper".

anydigital’s picture

I the same case I have the following:

Notice: Undefined index: entities in Drupal\bricks_inline\Plugin\Field\FieldWidget\BricksTreeInlineWidget->massageFormValues() (line 40 of modules/bricks/modules/bricks_inline/src/Plugin/Field/FieldWidget/BricksTreeInlineWidget.php).
Drupal\bricks_inline\Plugin\Field\FieldWidget\BricksTreeInlineWidget->massageFormValues(Array, Array, Object) (Line: 578)
Drupal\inline_entity_form\Plugin\Field\FieldWidget\InlineEntityFormComplex->extractFormValues(Object, Array, Object) (Line: 222)
Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues(Object, Array, Object) (Line: 307)
Drupal\Core\Entity\ContentEntityForm->copyFormValuesToEntity(Object, Array, Object) (Line: 291)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 147)
Drupal\Core\Entity\ContentEntityForm->buildEntity(Array, Object) (Line: 178)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 83)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 270)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_bricky_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('node_bricky_form', Array, Object) (Line: 571)
Drupal\Core\Form\FormBuilder->processForm('node_bricky_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 113)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Why do you get ErrorException instead simple Notice?

Anyway we will merge the patch, but that's interesting. What is your PHP version?

anydigital’s picture

Aha! http://php.net/manual/en/language.errors.php7.php

I have to upgrade PHP locally to prevent such issues in future.

  • tonystar committed 4f04a0b on 8.x-1.x
    Issue #2883295 by mitsuroseba, tonystar: ErrorException: Undefined index...
anydigital’s picture

Merged, available in 8.x-1.x-dev release!

anydigital’s picture

Assigned: Unassigned » anydigital
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.