Render API Renderers for Drupal 8, Drupal 9

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

Renderers are the services that take a render array and convert it to HTML (or JSON, or any other format). As a module developer, understanding how they work will help you gain a better understanding of what happens behind the scenes when Drupal links an incoming request to your custom controller and then handles the data you return.

In this tutorial we'll:

  • Define renderers
  • List the renderers available in Drupal core
  • Demonstrate how you can create a link that forces the use of a different renderer

By the end of this tutorial, you should understand the role that renderers play in the Drupal render pipeline and when you might want to use one other than the default.