Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element!Ta...
Here's how to do it:
$row['name'] = [
'#plain_text' => $field_name,
'#wrapper_attributes' => ['colspan' => 2],
];
Comment | File | Size | Author |
---|---|---|---|
#6 | table example.png | 22.44 KB | shashikant_chauhan |
#5 | table_render_element_attributes-2803923-5.patch | 928 bytes | gianani |
#3 | table_render_element_attributes-2803923-3.patch | 689 bytes | gianani |
Comments
Comment #2
gianani CreditAttribution: gianani at Iksula commentedComment #3
gianani CreditAttribution: gianani at Iksula commentedAdding Patch.
Added row attributes and cell attributes example usage.
Comment #4
shashikant_chauhan CreditAttribution: shashikant_chauhan as a volunteer and at Iksula commentedAfter applying the patch, name cell will cover both columns ('colspan' => 2) and phone cell will be shown outside.
This can be improved by adding more appropriate usage example.
Comment #5
gianani CreditAttribution: gianani at Iksula commentedAdding new patch with more suitable example.
Comment #6
shashikant_chauhan CreditAttribution: shashikant_chauhan as a volunteer and at Iksula commentedLooks good to me.
Comment #7
alexpottCommitted and pushed af89f80 to 8.3.x and 9f1e31d to 8.2.x. Thanks!