Operation in Hook eca_content_entity_prepare_form() can be null

Created on 14 October 2024, about 1 month ago
Updated 15 October 2024, about 1 month ago

Problem/Motivation

In the hook eca_content_entity_prepare_form() the function argument $operation is always expecting a string. In the function called inside the hook
_eca_content_hook_handler()->prepareForm($entity, $operation, $form_state);
it is allowed to be null.

Steps to reproduce

Override Drupal\user\RegisterForm and don't call setOperation.

Proposed resolution

Make argument nullable.

Stacktrace:

Auf der Website ist ein unerwarteter Fehler aufgetreten. Versuchen Sie es spรคter noch einmal.

TypeError: eca_content_entity_prepare_form(): Argument #2 ($operation) must be of type string, null given, called in /var/www/html/core/lib/Drupal/Core/Entity/EntityForm.php on line 403 in eca_content_entity_prepare_form() (line 159 of modules/contrib/eca/modules/content/eca_content.module).
Drupal\Core\Entity\EntityForm->Drupal\Core\Entity\{closure}(Object, 'eca_content') (Line: 395) Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_prepare_form', Object) (Line: 400) Drupal\Core\Entity\EntityForm->prepareInvokeAll('entity_prepare_form', Object) (Line: 129) Drupal\Core\Entity\EntityForm->init(Object) (Line: 287) Drupal\Core\Entity\ContentEntityForm->init(Object) (Line: 97) Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 61) Drupal\create_user_and_add_to_group\Form\CreateUser->buildForm(Array, Object, Object) call_user_func_array(Array, Array) (Line: 536) Drupal\Core\Form\FormBuilder->retrieveForm('create_user_and_add_to_group_create_user', Object) (Line: 284) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121) 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: 53) 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: 741) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡นAustria eameyers

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.

Production build 0.71.5 2024