owenmck β created an issue.
Why does the page need review? Drivers section appears to be out of date. What information needs review? Starting in drupal:9.4.0 the stated architecture for the core drivers is deprecated. It is removed from drupal:11.0.0. For example The MySQL database driver has been moved to the core mysql module, so that its namespace is now
Drupal\mysql\Driver\Database\mysql
See https://www.drupal.org/node/3129492 What improvement is suggested?
A minor rewrite of this introductory information to update its explanation of Drupal's database drivers.
Added the verb, be, into a sentence: i.e. changed "so it reflects that there should one more element" to " so it reflects that there should be one more element"
In the Introduction section, minor English expression improvements.
In case anyone else comes here looking for help:
DOCUMENTATION
The documentation for the '#theme' =>'table'
render element can be a bit hard to find.
Here are 3 places I have found in Drupal 10, where the documentation is helpful. (A bit of experimenting on your own will greatly help you too):
\Drupal\Core\Render\Element\Table
, which is /core/lib/Drupal/Core/Render/Element/Table.php- Further documentation is available in /core/includes/theme.inc::template_preprocess_table()
- Also look in /core/modules/system/templates/table.html.twig
Here are some minor edits, which got the above sample table rendering as intended for me, in Drupal 10:
Suggested solution
/**
* @return array
*/
public function tableRenderTest(): array {
return [
'#theme' => 'table',
'#caption' => 'My Table Caption',
'#attributes' => ['class' => 'my-table-class'],
/*
Note: the tag <thead> is hard-coded into the default 'table.html.twig'.
Also the <tr> tag nested below <thead> is hard-coded likewise.
If you intend to add attributes such as HTML classes to those tags
in your project then you must use your own version of the table template.
*/
'#header' => [
[
'data' => 'Name',
],
[
'data' => 'Age',
'class' => 'text-align-right'
],
[
'data' => 'City'
],
],
'#rows' => [
[
/* Begin row 1 */
'data' => [
[
'data' => 'John'
],
[
'data' => '12',
'class' => 'text-align-right'
],
[
'data' => 'DC'
],
],
'class' => 'my-row-class',
/* End row 1 */
],
[
/* Begin row 2 */
'data' => [
[
'data' => 'Mike',
],
[
'data' => '23',
'class' => ['text-align-right']
],
[
'data' => 'NY'
],
],
'class' => 'my-row-class1',
/* End row 2 */
],
]
];
}
Resulting HTML
<table class="my-table-class" data-striping="1">
<caption>My Table Caption</caption>
<thead>
<tr>
<th>Name</th>
<th class="text-align-right">Age</th>
<th>City</th>
</tr>
</thead>
<tbody>
<tr class="my-row-class">
<td>John</td>
<td class="text-align-right">12</td>
<td>DC</td>
</tr>
<tr class="my-row-class1">
<td>Mike</td>
<td class="text-align-right">23</td>
<td>NY</td>
</tr>
</tbody>
</table>
owenmck β created an issue.
"Webroot" is jargon which needs unpacking.
See
[Solved] where/what is "webroot" directory? β