Problem/Motivation

error

The website encountered an unexpected error. Please try again later.
Error: Call to a member function setComponent() on null in Drupal\paragraph_view_mode\StorageManager->addToFormDisplay() (line 141 of modules/paragraph_view_mode/src/StorageManager.php).
Drupal\paragraph_view_mode\StorageManager->addToFormDisplay('block_banner') (Line: 101)
paragraph_view_mode_form_paragraphs_type_edit_form_submit(Array, Object)
call_user_func_array('paragraph_view_mode_form_paragraphs_type_edit_form_submit', Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('paragraphs_type_edit_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->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: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->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: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

On the paragraph edit page, I check the checkbox and press the Save button

http://prntscr.com/txntrh
php 7.2.32
Drupal Version 8.9.1

Comments

proweb.ua created an issue. See original summary.

  • sayco committed 19f299e on 8.x-1.x
    Issue #3164535: Error: Call to a member function setComponent()
    
sayco’s picture

Hi, thanks for reporting. Indeed it seems like I haven't checked if the given form display was loaded properly. In your case, probably for that particular paragraph type the "default" form mode was not loaded. I've implemented a fix, which is checking if the given form display is an instance of EntityDisplayInterface if not It will print you a warning to place the field on the form manually and also create a log for that.
Please get the latest code from the develop branch and check if this solves your particular issue.

sayco’s picture

Status: Active » Needs review
sayco’s picture

Status: Needs review » Fixed

The mentioned fix is now shipped with a 1.6 version, please use the dev or 1.6 branches to make it work properly for your project. I'm closing the issue, please reopen in case the error will reoccur.

Status: Fixed » Closed (fixed)

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