Output Plain Text and Simple HTML Markup for Drupal 8, Drupal 9

Last updated March 4, 2021
Module Development8.9.x/9.0.x

Strings of simple HTML and plain text can be defined in a render array using the #markup and #plain_text element types. In this tutorial we'll look at:

  • Adding simple strings to a render array so they appear as HTML on the page
  • When to use #markup and #plain_text in your code

By the end of this tutorial, you should be able to add simple strings of HTML and plain text to a render array.