Score:0

Custom block not showing

in flag

I created a custom block module (nothing fancy, just an A-Z list and a taxonomy list for navigation), this worked fine in D8 & D9, now since upgrading to D10 it only shows when logged out, when logged in, it still writes a debug message to the Apache errorlog from the build() function, so I know the code is being called and I can dump the content to the log, I just get no display of the output. I have a few paths including . Log out and the block is displayed again.

All the answers I can find are for the block not displaying and requiring a login, this works fine until I login.

I'm outputting to the "hero" region and the region is displaying OK, just without my block content.

Any suggestions on what to look for?

Alex Monaghan avatar
in flag
Yes, all good, but surely if it was incompatible, it would fail regardless of logon?
cn flag
Could be caching with your theme. Try with one of the unmodified core themes and see if you can reproduce the issue.
id flag
Does the block have caching metadata? It’s not absolutely required: I’m just asking. Perhaps you should show the code.
Alex Monaghan avatar
in flag
main element of build is `$build = [ '#theme' => 'hopnavigation_block', '#commons' => $commons_menu, '#lords' => $lords_menu, '#az' => $az, '#constituency' => $con_az, ]; return $build;` `public function getCacheMaxAge(): int { return 0; }`
id flag
Please put code samples in the Question. It's difficult to format code in comments, and the Question should contain everything necessary for a fact-based answer.
id flag
Are there browser console errors?
Score:0
in flag

Not entirely an answer, but I put the same block into claro theme and all was good, the theme in use was a temporary testing theme so will create new one via starterkit so issue is resolved, even if the actual question was not answered. Testing theme was a clone of Olivero taken from 9.4 using the work at https://github.com/mherchel/olivero-subtheme if that helps others.

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.