So I'm programming a module in Drupal that contains several custom forms, one of which also has a table.
One section of the code of the table mentioned above looks like this:
$form['completion_' . $week] = array(
'#type' => 'table',
'#title' => 'Completion Week',
'#header' => array(' ', 'Header 1', 'Header 2', 'Header 3'),
);
The forms and the tables themselves work correctly. All that I want to do now is add a line break inside the strings of the header array, since my header titles are made of two strings.
So, it should look something like the following:
$form['completion_' . $week] = array(
'#type' => 'table',
'#title' => 'Completion Week',
'#header' => array(' ', $myTitle1 + Line Break + $myAdditionalText1, $myTitle2 + Line Break + $myAdditionalText2, $myTitle3 + Line Break + $myAdditionalText3),
);
What I have tried so far is the following:
- \n
- \r\n
- br-Tag
- nl2br
- PHP_EOL
For example, when I try ...
'#header' => array(' ', 'test1' . PHP_EOL . 'test2', "test1\r\ntest2", 'Header 3'),
... the line breaks for headers one and two get ignored and the string 'test2" remains on the same line as 'test1'.
Any ideas on how to enforce line breaks within the strings of the header array will be highly appreciated. Thank you very much.