You are here

function fasttoggle_block_view in Fasttoggle 7

Implements hook_block_view().

File

./fasttoggle.module, line 808
Enables fast toggling of binary or not so binary settings.

Code

function fasttoggle_block_view($delta = '') {
  $items = fasttoggle_block_link_register();
  if (empty($items)) {
    return;
  }
  foreach ($items as $group => $group_content) {
    foreach ($group_content as $key => $key_content) {
      $group_content[$key] = implode("<br />", $key_content);
    }
    $items[$group] = "<div class='fasttoggle-block-key'>" . implode("</div><div class='fasttoggle-block-key'>", $group_content) . "</div>";
  }
  $items = "<div class='fasttoggle-block-group'>" . implode("</div><div class='fasttoggle-block-group'>", $items) . "</div>";
  $block = array(
    'subject' => t('Fasttoggle Links'),
    'content' => [
      '#markup' => theme('container', [
        'element' => [
          '#children' => $items,
          '#attributes' => [
            'class' => 'fasttoggle-block',
          ],
        ],
      ]),
      '#attached' => [
        'css' => [
          drupal_get_path('module', 'fasttoggle') . '/css/fasttoggle.css',
        ],
      ],
    ],
  );
  return $block;
}