Score:0

Error with {{ page.highlighted }} while making a copy of Olivero

us flag

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?

LBRTYCAT avatar
us flag
After playing with it it seems like I am getting the same error even with `{{ page.highlighted }}` removed from the twig template...
Score:1
us flag

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.

Score:0
de flag

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.

Score:-1
gb flag

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

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.