The error message can be seen in Drupal 8.6.3 when editing your own user profile at user//edit :
The website encountered an unexpected error. Please try again later.
Error: Call to a member function getComponent() on null in hide_revision_field_form_user_form_alter() (line 46 of modules/contrib/hide_revision_field/hide_revision_field.module).hide_revision_field_form_user_form_alter(Array, Object, 'user_form') (Line: 539)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'user_form') (Line: 834)
Drupal\Core\Form\FormBuilder->prepareForm('user_form', Array, Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm('user_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
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: 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: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 669)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
jigish.addweb commented@ñull, I got the same error while installing the module & editing the Profile, I Worked on it & attached the patch for the same. Kindly review it & let me know your views on the same.
Thanks!..
Comment #3
ñull commentedSorry for late response. I applied the patch both in dev and production and It seems to fix the error. I had no time to think about the code, but I doubt if
$log= '';would be the right thing to do. I would need to clone the module to see the wider context of this. Let's leave it in Review status until someone else can give a third opinion.Comment #4
lobsterr commentedThe provided solution doesn't do anything except hiding the error.
This should display settings for log form for the current user.
Actually, it happens also, when user has right to edit it's own setting for revision log.
We need also to provide users a chance to set settings for other view forms
Comment #5
lobsterr commentedI was wrong the problem that some entity types don't have default form state. So, the check of $form_display would be enough. Anyway, I have changed the code. So, we will not pass some unnecessary checks and also added some refactoring
Comment #6
nsciaccaPatched in #5 worked for me to fix the error, but I had to re-roll it for 8.x-2.1 for use in my project.
Comment #7
nsciaccaComment #8
ghalenir commentedhide-revision-field-3018160-5-8.x-2.1.patch worked for me and I am using Drupal 8.7.1
Comment #9
felipe38113 commentedhide-revision-field-3018160-5-8.x-2.1.patch worked for me too :
Comment #10
xlith commentedhide-revision-field-3018160-5-8.x-2.1.patch worked for me too and I am using Drupal 8.7.1
Comment #11
lobsterr commentedI think we can mark it as TBC
Comment #12
logickal commentedWe are using 8.x-2.x-dev and found that the patch in #5 conflicts with #3031047: Not compatible with Media in Inline Entity Form / Entity Browser / Media library widget, so the attached re-roll takes those changes into account as well in case anyone else finds themselves in a similar situation.
Comment #13
redzeufhide_revision_field-3018160-user_profile_error_plus_media_incompatibility-12.patch worked for me on Drupal 8.7.2 and I'm applying the patch to hide revision field 8.x-2.1
Comment #14
jweirather commented+1 for @logickal's patch #12. Thank you all.
Comment #15
svenryen commentedpatch #12 works, applying it to 2.x-dev.
Comment #16
maxplus commentedHi,
we are using Drupal 8.7.5 and Media Library and hide_revision_field broke our image upload in the Media Library widget overlay.
=> patch #12 in combination on current hide_revision_field 2.x-dev fixed it
Thanks!
Comment #17
mrpauldriver commented#12 works for me
Comment #18
d.clarke commented#12 works for me as well against 2.x-dev.
Comment #19
ahmad abbad commented#12 works for me
Comment #20
digitalcatalyst commented#12 works for me with 2.x-dev
Comment #21
mably commentedCould it get merged in some way? We simply can't update our admin account on our production website anymore ;)
Comment #22
mgiffordI tried to apply patch #12 and got:
File to patch: src/Plugin/Field/FieldWidget/RevisionLogWidget.php
patching file src/Plugin/Field/FieldWidget/RevisionLogWidget.php
Hunk #2 FAILED at 183.
1 out of 2 hunks FAILED -- saving rejects to file src/Plugin/Field/FieldWidget/RevisionLogWidget.php.rej
Not sure what I did wrong, been a while since I did this. Just tried:
hide_revision_field $ patch < hide_revision_field-3018160-user_profile_error_plus_media_incompatibility-12.patchEDIT: Oh ya, I'm getting this error as I'm moving the site to Pantheon which uses a newer version of PHP than I was.
Comment #23
nkoporec#6 worked for me. I'm using 2.1.0 version.
Comment #24
swirt#6 works for me. It would be good to get this merged in. White screens on user/*/edit are bad.
Comment #25
superkhaliloo#6 is also ok for me. Could you merge this?
Comment #26
Mike.Brawley commented#6 is working for me.. Thank you for the patch. This should be merged.
Comment #27
oriol_e9gSame problem and #6 fixes the bug.
Comment #28
oriol_e9gThis is a reroll of #12 for dev to run tests with Drupal 8.9. I have changed the priority to major because the module without the patch breaks user edit and media library.
Comment #29
stefan.kornThis issue is about entity form displays that are available in configuration versus entity form displays that are not available in configuration.
The latter ones are raising the error (This is probably a reason why not all installations are affected).
The patches provided so far work around the error by skipping entity form displays that are not available in configuration.
Imho this is only a workaround, not a fix. The problem is in the way the entity form display is loaded in this module. This way is only working for entity form display available in configuration.
A different way of loading should be used to fix this issue:
- for Drupal 8.x entity_get_form_display can be used
- for Drupal 9 EntityDisplayRepositoryInterface::getFormDisplay can be used
That way also entity form displays that are not available in configuration will be handled here.
I will provide patches
Comment #30
stefan.kornThis is patch for 8.x-2.1 (and 8.x-2.x-dev)
Comment #31
stefan.kornThis is patch for Drupal 9 (starting to work with Drupal 8.8)
Comment #32
stefan.kornThis issue and patch from #30 and #31 is about broken User Edit-Page.
Anyone experiencing issues with Media Library and this module should check and apply patch from #3031047: Not compatible with Media in Inline Entity Form / Entity Browser / Media library widget.
#12 is mixing up both issues because #5 and #3031047: Not compatible with Media in Inline Entity Form / Entity Browser / Media library widget seem not to apply together. But #30 or #31 and #3031047: Not compatible with Media in Inline Entity Form / Entity Browser / Media library widget should apply together.
Comment #33
shaung75 commented#31 worked for me, thank you
Comment #34
dd 85 commented#31 works well!
Comment #35
cedeweyI also tested 31 and it works as expected. Thanks!
Comment #37
nickdickinsonwildeCommitted, thanks.