In Drupal 7, #type
'markup' was a distinction without a difference and caused confusion because including '#type' => 'markup'
in a render array was always optional and did not affect the rendering of markup added using the #markup
render array key in any way.
In Drupal 8, you can still add arbitrary markup to render arrays using the #markup
render array key, but '#type' => 'markup'
is no longer a valid type.
Unneeded #type specification:
array(
'#type' => 'markup',
'#markup' => 'Some arbitrary markup.',
);
Correct (for both Drupal 7 and Drupal 8):
array(
'#markup' => 'Some arbitrary markup.',
);
In Drupal 7, drupal_render() set #type
to markup internally before rendering if #markup
was set but #type
was not set. In Drupal 8, we no longer specify a #type
at all for markup, since '#type' => 'markup'
no longer affects the behaviour of the #markup
render array key.