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

ñull created an issue. See original summary.

jigish.addweb’s picture

Status: Active » Needs review
StatusFileSize
new838 bytes

@ñ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!..

ñull’s picture

Sorry 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.

lobsterr’s picture

Status: Needs review » Needs work

The 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

lobsterr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB

I 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

nsciacca’s picture

Patched 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.

nsciacca’s picture

ghalenir’s picture

hide-revision-field-3018160-5-8.x-2.1.patch worked for me and I am using Drupal 8.7.1

felipe38113’s picture

hide-revision-field-3018160-5-8.x-2.1.patch worked for me too :

  • Drupal 8.7.1
  • hide_revision_field 8.x-2.1
xlith’s picture

hide-revision-field-3018160-5-8.x-2.1.patch worked for me too and I am using Drupal 8.7.1

lobsterr’s picture

Status: Needs review » Reviewed & tested by the community

I think we can mark it as TBC

logickal’s picture

We 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.

redzeuf’s picture

hide_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

jweirather’s picture

+1 for @logickal's patch #12. Thank you all.

svenryen’s picture

patch #12 works, applying it to 2.x-dev.

maxplus’s picture

Hi,
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!

mrpauldriver’s picture

#12 works for me

d.clarke’s picture

#12 works for me as well against 2.x-dev.

ahmad abbad’s picture

#12 works for me

digitalcatalyst’s picture

#12 works for me with 2.x-dev

mably’s picture

Could it get merged in some way? We simply can't update our admin account on our production website anymore ;)

mgifford’s picture

I 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.patch

EDIT: 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.

nkoporec’s picture

#6 worked for me. I'm using 2.1.0 version.

swirt’s picture

#6 works for me. It would be good to get this merged in. White screens on user/*/edit are bad.

superkhaliloo’s picture

#6 is also ok for me. Could you merge this?

Mike.Brawley’s picture

#6 is working for me.. Thank you for the patch. This should be merged.

oriol_e9g’s picture

Same problem and #6 fixes the bug.

oriol_e9g’s picture

Priority: Normal » Major
StatusFileSize
new3.2 KB

This 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.

stefan.korn’s picture

Assigned: Unassigned » stefan.korn
Status: Reviewed & tested by the community » Needs work

This 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

stefan.korn’s picture

This is patch for 8.x-2.1 (and 8.x-2.x-dev)

stefan.korn’s picture

Assigned: stefan.korn » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.36 KB

This is patch for Drupal 9 (starting to work with Drupal 8.8)

stefan.korn’s picture

This 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.

shaung75’s picture

#31 worked for me, thank you

dd 85’s picture

#31 works well!

cedewey’s picture

Status: Needs review » Reviewed & tested by the community

I also tested 31 and it works as expected. Thanks!

  • stefan.korn authored 6599046 on 8.x-2.x
    Issue #3018160 by stefan.korn, LOBsTerr, oriol_e9g, nsciacca, logickal,...
nickdickinsonwilde’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

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