Problem/Motivation
table.html.twig allows setting attributes on the tr elements inside tbody, but not the one inside thead. It would be useful to be able to do this.
Proposed resolution
#header is currently an array of cells. Make it so that if #header contains the key cells, then that is interpreted to be an array of cells and any values in the key row_attributes are added as attributes on the tr.
Remaining tasks
Agree on form of #header. Implement in table.html.twig and template_preprocess_table().
User interface changes
None.
API changes
Additional keys in #header.
Data model changes
None.
Release notes snippet
Issue fork drupal-3421188
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #6
govind_giri_goswami commentedComment #7
govind_giri_goswami commentedIn both the table.html.twig template and the template_preprocess_table() function, we enabled the addition of attributes to the
section based on the header.row_attributes variable.
Comment #8
smustgrave commentedDid a small review but seems to be a number of scope changes.
Solution doesn't match the proposed solution
Will need test coverage
If editing a core template they all will have to be updated and CR written.
Comment #9
govind_giri_goswami commentedThe modifications to the template_preprocess_table() function enable the setting of attributes for tr elements within the thead of the table. This is achieved by introducing a check for row_attributes within the loop that processes header cells. If row_attributes are present, they are assigned to the respective header cell. Additionally, the row_attributes are merged with existing cell_attributes to ensure preservation of both cell and row attributes.
Comment #10
smustgrave commentedStill seems out of scope changes are still there.
Still missing tests
See just one template is updated and not the others.
No change record.
Comment #11
govind_giri_goswami commentedimproved MR
Comment #12
smustgrave commented#10 still applies
Comment #13
liam morlandComment #20
liam morlandThere is no need to create a new merge request when doing a reroll. You can use the same branch and use
git push --force. GitLab is set to create a tag pointing to the old code so that nothing is lost.