- last update
over 1 year ago 25 pass, 8 fail - Issue created by @EthanT
The last submitted patch, lightning-media-null-safe-operator-add.patch, failed testing. View results →
- last update
over 1 year ago 25 pass, 8 fail - Status changed to Needs work
over 1 year ago 11:21am 21 June 2023 - 🇮🇳India supriya1992
Hello EthanT,
Could you add the step to reproduce the issue? I was looking into this but couldn't able to reproduce it. - Status changed to Needs review
over 1 year ago 12:17pm 5 July 2023 - last update
over 1 year ago 32 pass - 🇮🇳India Ajeet Tiwari
Sorry patch did not get uploaded due to some technical glitch.
- 🇨🇿Czech Republic Jiskra
Hi @ajeet-tiwari
The patch is not working for me as also row
$item_class = $item->getSourceFieldDefinition($media_type)
returns null I am having the same issue when trying to add media. The patch did not work for me either. Here is the full error:
The website encountered an unexpected error. Please try again later. Error: Call to a member function getItemDefinition() on null in Drupal\lightning_media\Plugin\EntityBrowser\Widget\FileUpload->isAllowedType() (line 252 of modules/contrib/lightning_media/src/Plugin/EntityBrowser/Widget/FileUpload.php). array_filter(Array, Array) (Line: 243) Drupal\lightning_media\Plugin\EntityBrowser\Widget\EntityFormProxy->getAllowedTypes() (Line: 305) Drupal\lightning_media\Plugin\EntityBrowser\Widget\EntityFormProxy->access() (Line: 309) Drupal\entity_browser\Entity\EntityBrowser->Drupal\entity_browser\Entity\{closure}('044d2af7-314b-4830-8b6d-64896bbb861e') array_filter(Array, Object) (Line: 310) Drupal\entity_browser\Entity\EntityBrowser->getFirstWidget() (Line: 271) Drupal\entity_browser\Form\EntityBrowserForm->getCurrentWidget(Object) (Line: 160) Drupal\entity_browser\Form\EntityBrowserForm->buildForm(Array, Object) call_user_func_array(Array, Array) (Line: 536) Drupal\Core\Form\FormBuilder->retrieveForm('entity_browser_media_browser_form', Object) (Line: 283) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 104) Drupal\autosave_form\Form\AutosaveFormBuilder->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: 592) 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: 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: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
I have never done a patch before on an issue before but this works for me:
if ($is_allowed) { $source_field_definition = $media_type->getSource()->getSourceFieldDefinition($media_type); if ($source_field_definition){ if ($source_field_definition->getItemDefinition()->getClass()) { $item_class = $source_field_definition->getItemDefinition()->getClass(); $is_allowed = is_a($item_class, FileItem::class, TRUE); } } }