PHP warnings when using CKEditor plugin to access DAM through media library

Created on 15 August 2024, 4 months ago
Updated 30 August 2024, 4 months ago

Problem/Motivation

The following PHP warnings are logged after using the "Insert Media" CKEditor button (plugin) to access the DAM by way of the Media Library and add an image:

Warning: Undefined array key "field_name" in Drupal\ib_dam_media\Form\MediaLibraryIbDamBrowserForm->buildForm() (line 194 of /src/web/modules/contrib/intelligencebank/modules/ib_dam_media/src/Form/MediaLibraryIbDamBrowserForm.php)
#0 /src/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 /src/web/modules/contrib/intelligencebank/modules/ib_dam_media/src/Form/MediaLibraryIbDamBrowserForm.php(194): _drupal_error_handler()
#2 [internal function]: Drupal\ib_dam_media\Form\MediaLibraryIbDamBrowserForm->buildForm()
#3 /src/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#4 /src/web/core/lib/Drupal/Core/Form/FormBuilder.php(284): Drupal\Core\Form\FormBuilder->retrieveForm()
#5 /src/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#6 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#7 /src/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#8 /src/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /src/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#10 /src/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#11 /src/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /src/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#13 /src/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#14 /src/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#15 /src/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#16 /src/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#17 /src/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#18 /src/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#19 /src/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#20 /src/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#21 /src/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#22 /src/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#23 /src/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#24 /src/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#25 {main}
Warning: Undefined array key "entity_type_id" in Drupal\ib_dam_media\Form\MediaLibraryIbDamBrowserForm->buildForm() (line 195 of /src/web/modules/contrib/intelligencebank/modules/ib_dam_media/src/Form/MediaLibraryIbDamBrowserForm.php)
...
Warning: Undefined array key "bundle" in Drupal\ib_dam_media\Form\MediaLibraryIbDamBrowserForm->buildForm() (line 196 of /src/web/modules/contrib/intelligencebank/modules/ib_dam_media/src/Form/MediaLibraryIbDamBrowserForm.php)
...

Steps to reproduce

  1. Create a node containing a text area field with a text format that has a CKEditor config with the "Insert media" button (plugin) enabled.
  2. Click the "Insert media" button in the CKeditor to load the media library
  3. Click the "Open IntelligenceBank Browser"
  4. Select and download an image from the DAM
  5. Select the downloaded image in the Media library
  6. Save the node
  7. Find warnings in log

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

4.1

Component

IB: Media integration

Created by

πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024