You are here

sna_blocks.module in Simple Node Archive Blocks 7.2

Same filename and directory in other branches
  1. 8 sna_blocks.module
  2. 6 sna_blocks.module
  3. 7 sna_blocks.module

Provides Simple Node archive style options for Views.

File

sna_blocks.module
View source
<?php

/**
 * @file
 * Provides Simple Node archive style options for Views.
 */

/**
 * Implements hook_views_api().
 */
function sna_blocks_views_api() {
  return array(
    'api' => '3',
    'path' => drupal_get_path('module', 'sna_blocks'),
  );
}

/**
 * Check whether snablocks style_plugin is set for a view page.
 * If found return style_options.
 *
 * @param string $view_name
 *   The machine name of the view.
 * @param string $display_id
 *   The view page display id, e.g. page_1.
 *
 * @return array style_options
 *   An array view style_options.
 */
function sna_blocks_get_view_style_options($view_name, $display_id) {
  $style_options = array();
  $views = views_get_all_views();
  foreach ($views as $view) {
    foreach ($view->display as $display) {
      if ($display->display_plugin == 'block' && isset($display->display_options['style_plugin']) && $display->display_options['style_plugin'] == 'snablocks') {
        if ($display->display_options['style_options']['sna_view_name'] == $view_name && $display->display_options['style_options']['sna_view_display_id'] == $display_id) {
          $style_options = $display->display_options['style_options'];
          $style_options['vid'] = $display->vid;
          $style_options['id'] = $display->id;
        }
      }
    }
  }
  return $style_options;
}

/**
 * Need to have preprocess functions here because drupal doesn't cache them
 * correctly in the theme.inc file.
 */

// Trying to make sure the theme.inc get's loaded.
include_once 'theme/sna_blocks.theme.inc';
function template_preprocess_sna_blocks(&$vars) {
  _sna_blocks_preprocess_sna_blocks($vars);
}

Functions

Namesort descending Description
sna_blocks_get_view_style_options Check whether snablocks style_plugin is set for a view page. If found return style_options.
sna_blocks_views_api Implements hook_views_api().
template_preprocess_sna_blocks