0

I am trying to learn Drupal 9 theming by copying Olivero theme into my themes folder.

I copied web/core/themes/olivero to web/themes/olive and then renamed all file names containing 'olivero' to replace it with 'olive'. Then I replaced all text inside all files from 'olivero' to 'olive'.

This gives me the error:

The website encountered an unexpected error. Please try again later. TypeError: Drupal\Core\Render\Renderer::doTrustedCallback(): Argument #1 ($callback) must be of type callable, array given, called in /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php on line 788 in Drupal\Core\Render\Renderer->doTrustedCallback() (line 51 of core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php).

I realized that the theme works if I remove {{ page.highlighted }} from the web/themes/olive/templates/layout/page.html.twig

Also, the theme seems to be working fine if I don't rename it and keep it olivero even if I move it to web/themes/

Can you please help me figure out how to fix this error and keep the {{ page.highlighted }} block?

1
  • After playing with it it seems like I am getting the same error even with {{ page.highlighted }} removed from the twig template...
    – LBRTYCAT
    Mar 21, 2023 at 23:05

3 Answers 3

1

Ok, I figured the issue out -- while renaming I failed to rename one file web/themes/olivero/src/OliveroPreRender.php because of the capitalization. Renaming the file + updating the class name fixes the problem.

0

You should not copy the theme to your local folder. If you want to modify a core theme, you should create a sub-theme of the theme you want to alter, and make your edits there. This means that any updates to the core module will flow down to your sub-theme.

-1

Copying core themes and use it in themes/ is a wrong way in Drupal. Rather You should create a custom theme having a base theme Olivero.

You should follow this theme where I use Olivero as base theme: https://github.com/priyadegwekar/drupal9/tree/priya/web/themes/custom/olivero_sub_theme

With this you can keep highlighted region too.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.