You are here

function theme_theming_example_list in Examples for Developers 7

Theming a simple list.

This is just a simple wrapper around theme('item_list') but it's worth showing how a custom theme function can be implemented.

See also

theme_item_list()

Related topics

1 theme call to theme_theming_example_list()
theming_example_list_page in theming_example/theming_example.module
The list page callback.

File

theming_example/theming_example.module, line 306
Explains how a module declares theme functions, preprocess functions, and templates.

Code

function theme_theming_example_list($variables) {
  $title = $variables['title'];
  $items = $variables['items'];

  // Add the title to the list theme and
  // state the list type. This defaults to 'ul'.
  // Add a css class so that you can modify the list styling.
  // We'll just call theme('item_list') to render.
  $variables = array(
    'items' => $items,
    'title' => $title,
    'type' => 'ol',
    'attributes' => array(
      'class' => 'theming-example-list',
    ),
  );
  $output = theme('item_list', $variables);
  return $output;
}