You are here

views_rss.module in Views RSS 6

File

views_rss.module
View source
<?php

/**
 * Implementation of hook_views_api().
 */
function views_rss_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'views_rss') . '/views',
  );
}

/**
 * Implementation of hook_theme().
 */
function views_rss_theme() {
  $path = drupal_get_path('module', 'views_rss');
  $theme = array(
    'views_rss_fields_item' => array(
      'arguments' => array(
        'item' => array(),
      ),
      'file' => 'views_rss_views_fields.theme.inc',
      'template' => 'views-rss-fields-item',
      'path' => "{$path}/views",
    ),
    'views_rss_feed_icon' => array(
      'arguments' => array(
        'url',
        'title',
        'icon',
      ),
      'file' => 'views_rss_views_fields.theme.inc',
      'path' => "{$path}/views",
    ),
    'views_rss_feed_description' => array(
      'arguments' => array(
        'description',
        'view',
      ),
      'file' => 'views_rss_views_fields.theme.inc',
      'path' => "{$path}/views",
    ),
    'views_rss_feed_item_source' => array(
      'arguments' => array(
        'view',
      ),
      'file' => 'views_rss_views_fields.theme.inc',
      'path' => "{$path}/views",
    ),
    // CCK field formatters.
    'views_rss_formatter_views_rss_enclosure_image' => array(
      'arguments' => array(
        'element' => NULL,
      ),
      'function' => 'theme_views_rss_formatter_enclosure_image',
      'file' => 'views_rss_views_fields.theme.inc',
      'path' => "{$path}/views",
    ),
    'views_rss_formatter_views_rss_enclosure_file' => array(
      'arguments' => array(
        'element' => NULL,
      ),
      'function' => 'theme_views_rss_formatter_enclosure_file',
      'file' => 'views_rss_views_fields.theme.inc',
      'path' => "{$path}/views",
    ),
  );
  if (module_exists('imagecache')) {
    foreach (imagecache_presets() as $preset) {
      $theme['views_rss_formatter_views_rss_enclosure_image' . $preset['presetname']] = array(
        'arguments' => array(
          'element' => NULL,
        ),
        'function' => 'theme_views_rss_formatter_enclosure_image',
        'file' => 'views_rss_views_fields.theme.inc',
        'path' => "{$path}/views",
      );
    }
  }
  return $theme;
}

/**
 * Implementation of hook_field_formatter_info().
 */
function views_rss_field_formatter_info() {
  $formatters = array(
    // Generic image formatter for <enclosure> element.
    'views_rss_enclosure_image' => array(
      'label' => t('RSS enclosure element: image: original size'),
      'field types' => array(
        'image',
        'filefield',
      ),
    ),
    // Generic file formatter for <enclosure> element.
    'views_rss_enclosure_file' => array(
      'label' => t('RSS enclosure element: file'),
      'field types' => array(
        'filefield',
      ),
    ),
  );

  // Additional formatters for imagecache module.
  if (module_exists('imagecache')) {
    foreach (imagecache_presets() as $preset) {

      // Imagecache image formatter for <enclosure> element.
      $formatters['views_rss_enclosure_image' . $preset['presetname']] = array(
        'label' => t('RSS enclosure element: image: @preset', array(
          '@preset' => $preset['presetname'],
        )),
        'field types' => array(
          'image',
          'filefield',
        ),
      );
    }
  }
  return $formatters;
}

Functions

Namesort descending Description
views_rss_field_formatter_info Implementation of hook_field_formatter_info().
views_rss_theme Implementation of hook_theme().
views_rss_views_api Implementation of hook_views_api().