You are here

function wp_blog_block_view in WP Blog - a WordPress-style blogging module. 7

Implements hook_block_view().

File

./wp_blog.module, line 201
WP Blog provides a content-type, taxonomy vocabulary, views and various features to mimic a WordPress-style blog.

Code

function wp_blog_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'date_navigation':
      $archive = _wp_blog_get_blog_archive_tree();

      // If there aren't any blog posts, hide the block.
      if (empty($archive)) {
        return;
      }
      $block = array(
        'subject' => t('Blog Archive'),
        'content' => array(
          'show_all_link' => l(t('All blog posts'), 'blog'),
          'archive' => $archive,
          '#theme' => 'wp_blog_archive',
          '#cache' => DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_USER,
          '#contextual_links' => array(
            // This contextual link depends on the menu_alter above.
            'wp_blog' => array(
              'node/add',
              array(),
            ),
          ),
        ),
      );
  }
  return $block;
}