You are here

function flippy_block_info in Flippy 7

Implements hook_block_info().

File

./flippy.module, line 566
Allows administrators to add previous/next pagers to any node type.

Code

function flippy_block_info() {
  $blocks = array();

  // Provide a pager block that will work for all node types
  $blocks['flippy_pager'] = array(
    'info' => t('Flippy Pager (all node types)'),
    'cache' => DRUPAL_NO_CACHE,
  );

  // Provide node-type specific pager blocks
  foreach (node_type_get_types() as $type) {

    // See if this node type has pagers enabled
    if (variable_get("flippy_{$type->type}", FALSE)) {

      // Add support for machine names > 32 chars
      if (strlen("flippy_pager-node_type-{$type->type}") > 32) {
        $delta = flippy_block_hash_delta($type->type);
      }
      else {
        $delta = "flippy_pager-node_type-{$type->type}";
      }
      $blocks[$delta] = array(
        'info' => t('Flippy Pager (@type nodes)', array(
          '@type' => $type->name,
        )),
        'cache' => DRUPAL_NO_CACHE,
      );
    }
  }
  return $blocks;
}