function theme_theming_example_content_array in Examples for Developers 7
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
- theming_example/
theming_example.module, line 282 - 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>' . $element[$count]['#children'] . '</strong></p>';
}
else {
// Following paragraphs are just output as routine paragraphs.
$output .= '<p>' . $element[$count]['#children'] . '</p>';
}
}
return $output;
}