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
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | theme_function-3190943-33de7380.patch | 5.49 KB | eelkeblok |
| #10 | error_message.png | 65.09 KB | larisse |
Issue fork logging_alerts-3190943
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
Comment #4
joelpittetIt 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.
Comment #5
khaldoon_masud commentedAny progress on this?
Comment #6
Tilo Schumann commented+1
Comment #7
pedrocorse commentedHello,
have you got a solution ?
thanks
Comment #8
paintingguy commentedsame issue, any suggestion on how to resolve this would be grateful. Thank you
Comment #9
abu-zakham commentedi will look into this asap
Comment #10
larisse commentedI'm facing the same problem in Drupal 9.3.4
Comment #11
leisurman commentedThe 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
Comment #12
leisurman commentedThe 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
Comment #13
_atti_ commentedHi! 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.
Comment #16
gruda commentedThis pr will replace the render function as described above.
It will still be necessary to address the theme function issue before Drupal 10.
Comment #18
abu-zakham commentedComment #21
abu-zakham commentedComment #22
frosty29 commentedI 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)
Comment #23
abu-zakham commentedfeel free to reopen the issue
Comment #24
abu-zakham commentedComment #31
sgoodwin commentedChanging to needs review. The theme function is removed. Also, the table with checkboxes is moved to the EmaillogConfigForm class.
Comment #32
the_g_bomb commentedPatch https://git.drupalcode.org/project/logging_alerts/-/merge_requests/4.diff installs and suppresses the watchdog errors as expected.
Comment #34
the_g_bomb commentedAdded D10 compatibility
https://git.drupalcode.org/project/logging_alerts/-/merge_requests/5.diff
Try adding the patch with:
or
Comment #35
eelkeblokAttached 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.
Comment #38
poker10 commentedI 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!