Error when creating a new entity reference field

Created on 29 February 2024, 9 months ago
Updated 1 May 2024, 7 months ago

I have tried to create an entity reference field on the user and got the following error in the Administration page:

Error message
Warning: Undefined array key "third_party_settings" in Drupal\Core\Field\WidgetBase::create() (line 64 of core/lib/Drupal/Core/Field/WidgetBase.php).

Drupal\Core\Field\WidgetBase::create(Object, Array, 'entity_reference_autocomplete', Array) (Line: 122)
Drupal\Core\Field\WidgetPluginManager->createInstance('entity_reference_autocomplete', Array) (Line: 110)
Drupal\Core\Field\WidgetPluginManager->getInstance(Array) (Line: 369)
Drupal\Core\Field\FieldItemList->defaultValueWidget(Object) (Line: 284)
Drupal\Core\Field\FieldItemList->defaultValuesForm(Array, Object) (Line: 230)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default', Array) (Line: 63)
Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm('user', 'field_puncte')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
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: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->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: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @dalra
  • Status changed to Postponed: needs info 9 months ago
  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    I cannot reproduce it. Could you provide some steps?

  • I have reproduced it again.

    1. Install and enable Points
    2. Go to /admin/config/people/accounts/fields/add-field and try to add an entity reference field.
    Enter the new field name, select the type reference, choose Other and click Continue.
    The error occurs.

    3. Go to /admin/modules and see the error there as well
    4. Uninstall Points and the error no longer occurs

    I have Multilingual enabled, not sure it's related to this.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    sorry...
    still cannot reproduce it. I don't have any errors after clicking on the Save and continue button (attached screenshot).

  • I have reproduced it again on a clean new site.

    Create a new point type.
    In the points list add some positive and negative points.
    Go to /admin/config/people/accounts/fields/add-field and create an entity reference field to that new point.
    Error

  • I'm getting a similar error at step 4 of the README configuration instructions. "Type of item to reference" is Point. "Point type" is Default. I'm using the Basic Page content type just for testing. Also I'm not seeing how you get to the path for "My points" in your screenshot. I'm using Drupal 10.2.3. Am I missing a module maybe? Also your screenshot shows "Type of item to reference" is Content. What am I missing?

  • It can be reproduced any time on SimplyTest.me
    with the latest version of Points.
    After the installation just go to /admin/config/people/accounts/fields and try to add a reference field to Point

  • After the initial error, if you go to /user/1 you get this one:

    The website encountered an unexpected error. Try again later.

    TypeError: Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::__construct(): Argument #7 ($third_party_settings) must be of type array, null given, called in /var/lib/tugboat/stm/web/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php on line 112 in Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter->__construct() (line 91 of core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php).

    Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::create(Object, Array, 'entity_reference_entity_view', Array) (Line: 64)
    Drupal\Core\Field\FormatterPluginManager->createInstance('entity_reference_entity_view', Array) (Line: 126)
    Drupal\Core\Field\FormatterPluginManager->getInstance(Array) (Line: 210)
    Drupal\Core\Entity\Entity\EntityViewDisplay->getRenderer('field_point') (Line: 241)
    Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 339)
    Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 281)
    Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 238)
    Drupal\Core\Entity\EntityViewBuilder->build(Array)
    call_user_func_array(Array, Array) (Line: 111)
    Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 β†’ ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 859)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 421)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 239)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
    call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->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: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

  • Status changed to Active 7 months ago
  • Merge request !12Issue #3424732 - Fix saving widget β†’ (Merged) created by AstonVictor
  • Status changed to Fixed 7 months ago
  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    I was able to reproduce it after updating the core. Drupal has a new page for adding fields that caused the issue.
    Should be fixed. Please, update to the 2.0.2 version.

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

Production build 0.71.5 2024