why render array used in drupal theming layer instead all theming functionality can be achieved by using print statements in templates files.Any analogy that explain use of render array in theming layer and how it interact with tpl.php files.please answer the question little bit in descriptive way because i am drupal newbie.
|
A render array is a classic Drupal structured array that provides data (probably nested) along with hints as to how it should be rendered (properties, like #type). render($content['body']) contains everything in a structure in which the render function can turn it into display. This includes all your fields. print $body[0]['value'] simply prints the value of that one field bypassing any rendering functionality such as "weight". Rendering is a fun thing in Drupal, especially when you get to Drupal 7. Think of what you're passing into "render" as instructions on how to output, whereas the value is simply... a string... a value. Nice documentation regarding Render Arrrays in Drupal 7 on Drupal.org |
|||
|