1 theming_example.module theme_theming_example_content_array($variables)

Theme a simple content array.

This theme function uses the newer recommended format where a single render array is provided to the theme function.

Related topics

File

modules/examples/theming_example/theming_example.module, line 284
Explains how a module declares theme functions, preprocess functions, and templates.

Code

function theme_theming_example_content_array($variables) {
  $element = $variables['element'];
  $output = '';
  foreach (element_children($element) as $count) {
    if (!$count) {
      // The first paragraph is bolded.
      $output .= '<p><strong>' . render($element[$count]) . '</strong></p>';
    }
    else {
      // Following paragraphs are just output as routine paragraphs.
      $output .= '<p>' . render($element[$count]) . '</p>';
    }
  }
  return $output;
}