You are here

function theme_feeds_ui_container in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds_ui/feeds_ui.admin.inc \theme_feeds_ui_container()
  2. 6 feeds_ui/feeds_ui.admin.inc \theme_feeds_ui_container()
  3. 7 feeds_ui/feeds_ui.admin.inc \theme_feeds_ui_container()

Render a simple container. A container can have a title, a description and one or more actions. Recursive.

@todo Replace with theme_fieldset or a wrapper to theme_fieldset?

Parameters

$variables: An array containing an array at 'container'. A 'container' array may contain one or more of the following keys: array( 'title' => 'the title', 'body' => 'the body of the container, may also be an array of more containers or a renderable array.', 'class' => array('the class of the container.'), 'id' => 'the id of the container', );

2 theme calls to theme_feeds_ui_container()
theme_feeds_ui_edit_page in feeds_ui/feeds_ui.admin.inc
Theme feeds_ui_edit_page().
theme_feeds_ui_plugin_form in feeds_ui/feeds_ui.admin.inc
Theme feeds_ui_plugin_form().

File

feeds_ui/feeds_ui.admin.inc, line 998
Contains all page callbacks, forms and theming functions for Feeds administrative pages.

Code

function theme_feeds_ui_container($variables) {
  $container = $variables['container'];
  $class = array_merge(array(
    'feeds-container',
  ), empty($container['class']) ? array(
    'plain',
  ) : $container['class']);
  $id = empty($container['id']) ? '' : ' id="' . $container['id'] . '"';
  $output = '<div class="' . implode(' ', $class) . '"' . $id . '>';
  if (isset($container['actions']) && count($container['actions'])) {
    $output .= '<ul class="container-actions">';
    foreach ($container['actions'] as $action) {
      $output .= '<li>' . $action . '</li>';
    }
    $output .= '</ul>';
  }
  if (!empty($container['title'])) {
    $output .= '<h4 class="feeds-container-title">';
    $output .= $container['title'];
    $output .= '</h4>';
  }
  if (!empty($container['body'])) {
    $output .= '<div class="feeds-container-body">';
    if (is_array($container['body'])) {
      if (isset($container['body']['#type'])) {
        $output .= drupal_render($container['body']);
      }
      else {
        foreach ($container['body'] as $c) {
          $output .= theme('feeds_ui_container', array(
            'container' => $c,
          ));
        }
      }
    }
    else {
      $output .= $container['body'];
    }
    $output .= '</div>';
  }
  $output .= '</div>';
  return $output;
}