In a custom controller, when I try to use drupal_set_message()
, it works only if I use the following code.
// The message is shown via {{ page.highlighted }}.
drupal_set_message('Test error', 'error');
return [
'#type' => 'markup',
'#markup' => "Welcome",
];
When I use the following code, it doesn’t work.
drupal_set_message('Test error', 'error');
return [
'#type' => 'page',
'#markup' => "Welcome",
];
I need to set #type
to page to be able to inject custom variables.
Can anybody help me to understand how it works?