πŸ‡ΊπŸ‡ΈUnited States @wdmartin

Account created on 8 November 2006, almost 18 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States wdmartin

I'll have to give that a try when I'm next at work, thank you very much.  Ironic that I just finished filing a bug report πŸ› Rendering engine disregards manual table cells Active . But even if it's not actually a bug, it would be nice to get that documentation updated.

πŸ‡ΊπŸ‡ΈUnited States wdmartin

Thank you for trying! It's nice to know that I'm not just crazy.

Looking at the output of {{ dump() }} in the template, I think the rendering engine actually makes data structures that match the twig template. Like, each row will have a cells array and so forth. But it's not honoring manually-created ones. Somewhere between the module and the template, the rendering engine overwrites the arrays from the module with automatically-generated ones that cram all the actual data into attributes. I'll go ahead and file a bug report, but I suspect it's going to be pretty low priority. I don't think many people use row headers.

I went ahead and used #markup entries to create the tables for this module. I'm not a fan of mixing presentation logic into the backend this way. If we ever develop a new theme, this one module will have to be updated manually. But I needed it to work, and that did the trick.

πŸ‡ΊπŸ‡ΈUnited States wdmartin

Day 2: four more hours, for ten total so far. Spent some time wading through core code trying to track backwards from the point where my controller function gets called to see what Drupal is doing with the $build variable, because the version of that which eventually gets passed to table.html.twig bears only a faint resemblance to what I put in.

So far I've been able to verify that it makes it through early rendering fine. But then I lost track.  The variable gets passed off to something later in the rendering pipeline for further processing, but I haven't figured out which bit of Drupal's code works on it next.

In the faint hope that it might be useful, I tried asking ChatGPT.  It did not help.

Maybe I could skip Drupal's table rendering altogether, manually assemble the relevant HTML and stick it in a #markup element. That would work too. I'm a little surprised that getting a TH tag as the first cell in a table row is taking this Herculean level of effort.

Production build 0.71.5 2024