You are here

function theme_multiblock_general in MultiBlock 7

Same name and namespace in other branches
  1. 5 multiblock.module \theme_multiblock_general()
  2. 6 multiblock.module \theme_multiblock_general()

Theme function for the "Manage Block Instances" page.

1 theme call to theme_multiblock_general()
multiblock_general in ./multiblock.module
Page callback for the "Manage Block Instances page".

File

./multiblock.module, line 414
Enhances the block API, as provided by D7 Core.

Code

function theme_multiblock_general($variables) {
  extract($variables, EXTR_SKIP);
  $output = '';
  $noyes = array(
    'misc/watchdog-error.png',
    'misc/watchdog-ok.png',
  );
  $output .= '<p><h3>' . ($edit ? t('Edit Instance') : t('Add Instance')) . '</h3>' . $add_block_form . '</p>';
  $header = array(
    t('Title'),
    t('Original Block Title'),
    t('Original Module'),
    t('MultiBlock Enabled'),
    t('Original Delta'),
    t('Action'),
  );
  $rows = array();
  foreach ($multiblocks as $row) {
    $ops_link = l(t('Edit'), 'admin/structure/block/instances/edit/' . $row->delta) . ' ' . l(t('Delete'), 'admin/structure/block/instances/delete/' . $row->delta);
    $title = multiblock_get_block_title($row->module, $row->orig_delta);
    $mb_enabled = $noyes[$row->multi_settings];
    $alt = t('Not Multiblock enabled');
    if ($row->multi_settings) {
      $alt = t('Multiblock enabled');
    }
    $rows[] = array(
      check_plain($row->title),
      check_plain($title),
      $row->module,
      array(
        'data' => theme('image', array(
          'path' => $mb_enabled,
          'alt' => $alt,
          'title' => $alt,
        )),
        'align' => 'center',
      ),
      $row->orig_delta,
      $ops_link,
    );
  }
  $output .= '<p><h3>' . t('Manage Instances') . '</h3>';
  if (!empty($rows)) {
    $output .= theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  else {
    $output .= t('No instances defined yet.');
  }
  $output .= '</p>';
  return $output;
}