You are here

function theme_boxes_add_list in Boxes 7.2

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

Parameters

$variables: An associative array containing:

  • content: An array of box types.
1 theme call to theme_boxes_add_list()
boxes_add_page in includes/boxes.pages.inc
Menu Callback to list available box types to add

File

includes/boxes.pages.inc, line 145
Box Functions

Code

function theme_boxes_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="box-type-list admin-list">' . implode('', $blocks) . '</ul>';
  }
  else {
    $output = '<p>' . t('You have not created any block types yet.') . '</p>';
  }
  return $output;
}