You are here

function theme_workbench_element in Workbench 7

Generic theme function for use with Render API.

Renders the #title and #attributes properties if they are present.

2 theme calls to theme_workbench_element()
hook_workbench_create_alter in ./workbench.api.php
Allows modules to alter the default content creation page.
workbench_content in ./workbench.pages.inc
Page callback for the workbench content page.

File

./workbench.theme.inc, line 13
Theme file stub for Workbench.

Code

function theme_workbench_element($variables) {
  $element = $variables['element'];

  // Use the #title attribute.
  $title = '';
  if (!empty($element['#title'])) {
    $title = '<h3>' . check_plain($element['#title']) . '</h3>';
  }
  $contextual = '';
  if (!empty($element['contextual_links'])) {
    $contextual = drupal_render($element['contextual_links']);
    $element['#attributes']['class'][] = 'contextual-links-region';
  }

  // Use #attributes to customize a wrapper <div>.
  $attributes = '';
  if (!empty($element['#attributes'])) {
    $attributes = drupal_attributes($element['#attributes']);
  }

  // Render any child items.
  if (!$element['#children']) {
    $element['#children'] = drupal_render_children($element);
  }

  // Build simple output.
  $output = "<div{$attributes}>{$title}{$contextual}{$element['#children']}</div>";
  return $output;
}