Problem/Motivation

An error displays in the admin UI every time a module is enabled/disabled.
Using Drupal 9.1.0 + Logging and alerts 2.0.x-dev

Steps to reproduce

Navigate to Extend (/admin/modules) and enable a module.
The following error shows up:

 User deprecated function: Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_emaillog_admin_settings(). See https://www.drupal.org/node/1831138 in Drupal\Core\Theme\Registry->processExtension() (line 498 of core/lib/Drupal/Core/Theme/Registry.php).

Drupal\Core\Theme\Registry->processExtension(Array, 'emaillog', 'module', 'emaillog', 'modules/contrib/logging_alerts/emaillog') (Line: 341)
Drupal\Core\Theme\Registry->build() (Line: 240)
Drupal\Core\Theme\Registry->get() (Line: 88)
Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 69)
Drupal\Core\Utility\ThemeRegistry->__construct('theme_registry:runtime:claro', Object, Object, Array, 1) (Line: 260)
Drupal\Core\Theme\Registry->getRuntime() (Line: 142)
Drupal\Core\Theme\ThemeManager->render(Array, Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 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)

Alternatively using drush commands (drush pmu) to uninstall (disable) modules produces the same error to be displayed in the admin UI.

Proposed resolution

Deprecate theme function, as suggested by the error description.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jplana created an issue. See original summary.

joelpittet made their first commit to this issue’s fork.

joelpittet’s picture

It will take a bit of wrangling but I'd propose removing the theme_emaillog_admin_settings theme hook all together and building the table and checkboxes in the EmaillogConfigForm::buildForm(),.

Any reason this needs to be themeable? Most anybody doing the same thing would probably do an form alter hook.

khaldoon_masud’s picture

Any progress on this?

Tilo Schumann’s picture

+1

pedrocorse’s picture

Hello,

have you got a solution ?

thanks

paintingguy’s picture

same issue, any suggestion on how to resolve this would be grateful. Thank you

abu-zakham’s picture

i will look into this asap

larisse’s picture

StatusFileSize
new65.09 KB

I'm facing the same problem in Drupal 9.3.4

leisurman’s picture

The error goes away for me when I check 'Use legacy email subject' on the configuration page.
/admin/config/development/emaillog
I was only seeing the error right after logging in, after being logged out.
Using logging_alerts version: '2.0.0'
Drupal version 9.2.13

leisurman’s picture

The message is back even after checking 'Use legacy email subject' on the configuration page.
Using logging_alerts version: '2.0.0'
Using Drupal version 9.3.12

_atti_’s picture

Hi! Same issue here with D9.3.15.
The problem is the deprecated render function in emaillog.module / theme_emaillog_admin_settings. It's responsible only for admin view. If you comment this part some info not showing on the admin page, but the function seems work well.

gruda made their first commit to this issue’s fork.

gruda’s picture

This pr will replace the render function as described above.
It will still be necessary to address the theme function issue before Drupal 10.

abu-zakham’s picture

Status: Active » Fixed

  • abu-zakham committed b40a684 on 2.0.x authored by gruda
    Issue #3190943 by joelpittet, gruda, larisse, abu-zakham: User...
abu-zakham’s picture

Status: Fixed » Closed (fixed)
frosty29’s picture

I don't understand why this is set to closed (fixed). As gurda says #16
"It will still be necessary to address the theme function issue before Drupal 10."
I still get the same warning messages (Drupal 9.4.5, Logging and alerts 2.0.0+1-dev (2022-Jul-22)

abu-zakham’s picture

feel free to reopen the issue

abu-zakham’s picture

Status: Closed (fixed) » Needs work

sgoodwin made their first commit to this issue’s fork.

sgoodwin’s picture

Status: Needs work » Needs review

Changing to needs review. The theme function is removed. Also, the table with checkboxes is moved to the EmaillogConfigForm class.

the_g_bomb’s picture

Status: Needs review » Reviewed & tested by the community

Patch https://git.drupalcode.org/project/logging_alerts/-/merge_requests/4.diff installs and suppresses the watchdog errors as expected.

the_g_bomb’s picture

Added D10 compatibility
https://git.drupalcode.org/project/logging_alerts/-/merge_requests/5.diff

Try adding the patch with:

composer require mglaman/composer-drupal-lenient
composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/logging_alerts"]'
composer config --json --merge extra.patches.drupal/logging_alerts '{"3190943: User deprecated function": "https://git.drupalcode.org/project/logging_alerts/-/merge_requests/5.diff"}'
composer require --no-update 'drupal/logging_alerts:2.0.x-dev@dev'

or

composer config repositories.logging_alerts vcs git@git.drupal.org:issue/logging_alerts-3190943.git
composer require --no-update drupal/logging_alerts:dev-3190943-add-d10-compatibility
eelkeblok’s picture

StatusFileSize
new5.49 KB

Attached is a patch based on MR 4, but against 2.0.0 (the 2.0.x development branch already contains a change for this issue which breaks a patch generated from the pure diff of MR 4).

@the_g_bomb: Is this the only thing standing in the way of D10 compatibility of this module? In that case, I think it might be warranted to add this all in one go. One doubt I have is that the info.yml files claim wider core compatibility (^8...) than the composer.json (^8.8 ...). Maybe (just a suggestion) MR 4 should be merged and the D10-stuff left for a follow-up issue.

poker10 made their first commit to this issue’s fork.

  • poker10 committed 8d35d489 on 2.0.x authored by sgoodwin
    Issue #3190943 by joelpittet, gruda, larisse, abu-zakham: User...
poker10’s picture

Status: Reviewed & tested by the community » Fixed

I have merged the MR 4 into 2.0.x. Let's continue with all other D10 compatibility issues here: #3390107: Drupal 10 compatibility fixes

Thanks everyone!

Status: Fixed » Closed (fixed)

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