I went to create a new media type and got the following error:
The website encountered an unexpected error. Please try again later.
Error: Call to a member function id() on null in media_expire_form_media_type_form_alter() (line 25 of modules/contrib/media_expire/media_expire.module).
media_expire_form_media_type_form_alter(Array, Object, 'media_type_add_form') (Line: 539)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'media_type_add_form') (Line: 830)
Drupal\Core\Form\FormBuilder->prepareForm('media_type_add_form', Array, Object) (Line: 272)
Drupal\Core\Form\FormBuilder->buildForm('media_type_add_form', Object) (Line: 74)
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: 100)
Drupal\cleanpager\StackMiddleware\CleanPager->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: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 664)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Suggestions?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2973699-7.patch | 3.22 KB | chr.fritsch |
| #5 | before patch 2.png | 346.97 KB | riddhi.addweb |
| #5 | Before patch 1.png | 11.38 KB | riddhi.addweb |
| #5 | After patch .png | 95.25 KB | riddhi.addweb |
| #2 | media_expire-error-on-media-type-setup-2973699-2.patch | 1.33 KB | anu17 |
Comments
Comment #2
anu17 commentedWhen I had enabled media expire module, was facing an error on adding of new media type.
I have attached a patch solving the same issue.
Comment #3
anu17 commentedComment #4
anu17 commentedComment #5
riddhi.addweb commented@anu17, Thanks for solving this error, your patch is working fine for me. I checked it using simplytest.me & attached the screenshot for the same.
Comment #6
namit.garg commentedPatch works as expected
Comment #7
chr.fritschWe could do something smarter and just call the logic on the edit form. Then the object is always there.
Comment #9
chr.fritschFixed, thanks everyone