On several projects with simple_menu_icons module I got next errors on drush updb -y run:
exception 'Exception' with message 'The theme implementations may not[error]
be rendered until all modules are loaded.' in
/var/www/docroot/core/lib/Drupal/Core/Theme/ThemeManager.php:139
Stack trace:
#0 /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php(435):
Drupal\Core\Theme\ThemeManager->render('simple_menu_ico...', Array)
#1 /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php(195):
Drupal\Core\Render\Renderer->doRender(Array, true)
#2 /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php(151):
Drupal\Core\Render\Renderer->render(Array, true)
#3 /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php(574):
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#4 /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php(152):
Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext),
Object(Closure))
#5
/var/www/docroot/modules/patched/simple_menu_icons/simple_menu_icons.module(121):
Drupal\Core\Render\Renderer->renderPlain(Array)
#6
/var/www/docroot/modules/patched/simple_menu_icons/simple_menu_icons.module(146):
simple_menu_icons_css_generate()
#7 [internal function]: simple_menu_icons_cache_flush()
A quick investigation showed that problem in wrong using of hook_cache_flush - https://api.drupal.org/api/drupal/core!core.api.php/function/hook_cache_...
From documentation:
Do NOT use this hook for rebuilding information. Only use it to flush custom caches
This hook is invoked by drupal_flush_all_caches(). It runs before module data is updated and before hook_rebuild().
I suggest using hook_rebuild instead of hook_cache_flush - https://api.drupal.org/api/drupal/core%21core.api.php/function/hook_rebu...
This hook allows your module to rebuild its data based on the latest/current module data. It runs after hook_cache_flush() and after all module data has been updated.
This hook is only invoked after the system has been completely cleared; i.e., all previously cached data is known to be gone and every API in the system is known to return current information, so your module can safely rely on all available data to rebuild its own.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | theme-implementations-exception-2880544.patch | 428 bytes | hamrant |
Comments
Comment #2
hamrant commentedComment #3
anprok commentedChecked on drupal 8.3.2 with Simple Menu Icons installed. After drush updb -y run i got the same error with Simple Menu Icons module. After applying patch no any fails with database update.
Comment #4
sylvainar commentedActually I provided the same patch here : https://www.drupal.org/node/2871491
Comment #5
pifagorDone - http://cgit.drupalcode.org/simple_menu_icons/commit/?id=8ef7219
Comment #6
pifagor