Drupal 9 Call to undefined function Drupal\media_library_importer\Form\drupal_set_message()

Created on 12 January 2021, over 3 years ago
Updated 18 August 2023, about 1 year ago

Problem/Motivation

On sites using Drupal 9, a website error occurs when attempting to import due to a deprecated function being used in src/Form/ImportForm.php

The website encountered an unexpected error. Please try again later.
Error: Call to undefined function Drupal\media_library_importer\Form\drupal_set_message() in Drupal\media_library_importer\Form\ImportForm::batchMediaCreationFinished() (line 184 of modules/contrib/media_library_importer/src/Form/ImportForm.php).
Drupal\media_library_importer\Form\ImportForm::batchMediaCreationFinished(1, Array, Array, Object) (Line: 456)
_batch_finished() (Line: 98)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
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: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

1. Log into a site using Drupal 9
2. Go to /admin/config/media/media-library-importer/import
3. Select any media
4. Press submit
5. See error

Proposed resolution

Update the referenced drupal_set_message function with Messenger service.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bemarlan Ohio, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024