Hello, when you remove referenced entity than this module creates fatal errors.

plugin EntityReferenceRenderedDisabled do not handle load() properly, load may return NULL!

Error: Call to a member function getEntityTypeId() on null in Drupal\entityreference_rendered_widget\Plugin\Field\FieldWidget\EntityReferenceRenderedDisabled->formElement() (line 32 of /var/www/html/docroot/modules/contrib/entityreference_rendered_widget/src/Plugin/Field/FieldWidget/EntityReferenceRenderedDisabled.php) #0 /var/www/html/docroot/core/lib/Drupal/Core/Field/WidgetBase.php(335): Drupal\entityreference_rendered_widget\Plugin\Field\FieldWidget\EntityReferenceRenderedDisabled->formElement(Object(Drupal\Core\Field\EntityReferenceFieldItemList), 0, Array, Array, Object(Drupal\Core\Form\FormState)) #1 /var/www/html/docroot/core/lib/Drupal/Core/Field/WidgetBase.php(202): Drupal\Core\Field\WidgetBase->formSingleElement(Object(Drupal\Core\Field\EntityReferenceFieldItemList), 0, Array, Array, Object(Drupal\Core\Form\FormState)) #2 /var/www/html/docroot/core/lib/Drupal/Core/Field/WidgetBase.php(104): Drupal\Core\Field\WidgetBase->formMultipleElements(Object(Drupal\Core\Field\EntityReferenceFieldItemList), Array, Object(Drupal\Core\Form\FormState)) #3 /var/www/html/docroot/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(171): Drupal\Core\Field\WidgetBase->form(Object(Drupal\Core\Field\EntityReferenceFieldItemList), Array, Object(Drupal\Core\Form\FormState)) #4 /var/www/html/docroot/core/lib/Drupal/Core/Entity/ContentEntityForm.php(125): Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object(Drupal\node\Entity\Node), Array, Object(Drupal\Core\Form\FormState)) #5 /var/www/html/docroot/core/modules/node/src/NodeForm.php(115): Drupal\Core\Entity\ContentEntityForm->form(Array, Object(Drupal\Core\Form\FormState)) #6 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityForm.php(117): Drupal\node\NodeForm->form(Array, Object(Drupal\Core\Form\FormState)) #7 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState)) #8 /var/www/html/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(518): call_user_func_array(Array, Array) #9 /var/www/html/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(275): Drupal\Core\Form\FormBuilder->retrieveForm('node_tipp_edit_...', Object(Drupal\Core\Form\FormState)) #10 /var/www/html/docroot/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('node_tipp_edit_...', Object(Drupal\Core\Form\FormState)) #11 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #12 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #13 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #14 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #15 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #16 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #17 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #18 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/html/docroot/modules/contrib/jsonapi/src/StackMiddleware/FormatSetter.php(41): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #26 {main}.

Comments

mkolar created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new1.51 KB

I corrected the bug, here is the patch.

mkolar’s picture

Hi, i already created pull request on gitbub since development of this module is there.. https://github.com/guiajlopes/entityreference_rendered_widget/pull/1/com...

but it seems like maintainers are inactive :(

siva01’s picture

I found problem with rendering referenced entity, which was deleted. In this situation happen this error.

siva01’s picture

StatusFileSize
new1.09 KB

TypeError: Argument 1 passed to Drupal\Core\Field\WidgetBase::errorElement() must be of the type array, null given -> nonexisting entity must be set as null.

siva01’s picture

StatusFileSize
new1.25 KB

Adding markup with deleted entity message.

mkolar’s picture

Status: Needs review » Reviewed & tested by the community

We uses this patch for years now, RTBC

guilopes’s picture

this is applied on latest 8.x-1.x branch, as soon as I merge all the patches I'm gonna make a stable release

guilopes’s picture

Status: Reviewed & tested by the community » Fixed
mkolar’s picture

Do you give credit to sergiu-stici, siva01 and me for taking care of this. As its good practice. I dont see it.

guilopes’s picture

guilopes’s picture

I did add the credits to the issue, I guess it should be computed for you siva01 and Sergiu. The commit credits are defined by the commit message and author, since you did not specify anything on your commit (on github) it was not granted and I can't change it now since it's already pushed and drupalorg does not allow force push

Reference "Use the checkboxes, Author radio button, and Commit message field to generate a suggested commit message for the issue. While issue credits may be modified after the commit, commit message mentions can only be changed by amending the commit message (for git commits that are not yet pushed) or with reverting the commit and making the correction in a new commit (for commits that are pushed). Drupal.org prohibits the use of git force push to release branches, so making commit message changes that way is not possible." https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett...

mkolar’s picture

Actually i did the fix first as MR 21 Mar 2019 but it was ignored for long time...
So i should defo get credit, and usually even people who review gets credit.

https://github.com/guiajlopes/entityreference_rendered_widget/pull/1/com...

guilopes’s picture

yes I know, you had to commit like this: "git commit -m 'Issue #3042145 by siva01, Sergiu Stici, mkolar: Call to a member function getEntityTypeId() on null ' --author="siva01c " then all the credits would be in place. Since github is just a mirror of the drupalorg codebase it just publishes the exact same messages and authors on both repos

When I do the commits myself (applying patches I always give credits to the people involved)

anyway, I see you folks got the credits for the issue and just did not get the credits for the commits which is something we can't change anymore

mkolar’s picture

Np, I can see that i can now require this module for D9 core. Thanks, please take care of the module :) We may send some new patches soon since we make a upgrade.

Status: Fixed » Closed (fixed)

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