What is a render array?
Drupal’s theme system allows a theme to have nearly complete control over the appearance of the site, encompassing both the CSS responsible for styling the markup and the markup itself. Essentially, the system mandates that modules utilize render arrays instead of coding HTML markup directly. Render arrays are multidimensional arrays that contain both the rendering data to be transformed into HTML and the options that influence the markup.
Each level in the hierarchy of a render array (including the outermost array) has one or more array elements. Array elements whose names start with #
are known as properties, and the array elements with other names are children (constituting the next level of the hierarchy); the names of children are flexible, while property names are specific to the type of data being rendered.
For example, a render array that uses our theme hook, along with the data that should be passed to it, can be the following:
[ ...