You are here

function theme_bean_add_list in Bean (for Drupal 7) 7

Returns HTML for a list of available bean types for bean creation.

Parameters

$variables: An associative array containing:

  • content: An array of bean types.
1 theme call to theme_bean_add_list()
bean_add_page in includes/bean.pages.inc
Menu Callback to list available bean types to add

File

includes/bean.pages.inc, line 170
Bean Functions

Code

function theme_bean_add_list($variables) {
  $content = $variables['content'];
  $blocks = array();
  $i = 0;
  if ($content) {
    foreach ($content as $item) {
      $title = l(t('<span class="icon"></span>@label', array(
        '@label' => $item
          ->getLabel(),
      )), 'block/add/' . $item
        ->buildURL(), array(
        'html' => TRUE,
      ));
      $description = !is_array($item
        ->getDescription()) ? '<div class="description">' . $item
        ->getDescription() . '</div>' : '';

      //creative way to setup sorting by label; add number to prevent duplicate keys
      $blocks[str_replace(' ', '', $item
        ->getLabel()) . '_' . $i] = '<li>' . $title . $description . '</li>';
      $i++;
    }
    ksort($blocks);
    $output = '<ul class="bean-type-list admin-list">' . implode('', $blocks) . '</ul>';
  }
  else {
    $output = '<p>' . t('You have not created any block types yet.') . '</p>';
  }
  return $output;
}