1 theming_example.module theme_theming_example_list($variables)

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

File

modules/examples/theming_example/theming_example.module, line 308
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;
}