You are here

views_rss_media.module in Views RSS: Media (MRSS) Elements 7

Same filename and directory in other branches
  1. 8 views_rss_media.module

Provides Media RSS namespace, <channel> and <item> elements for Views RSS module.

File

views_rss_media.module
View source
<?php

/**
 * @file
 * Provides Media RSS namespace, <channel> and <item> elements for Views RSS module.
 */

/**
 * Module installation path.
 */
define('VIEWS_RSS_MEDIA_PATH', drupal_get_path('module', 'views_rss_media'));

/**
 * Include file with field formatters.
 */
include_once VIEWS_RSS_MEDIA_PATH . '/views_rss_media.field.inc';

/**
 * Include file with all preprocess functions.
 */
include_once VIEWS_RSS_MEDIA_PATH . '/views_rss_media.inc';

/**
 * Implements hook_help().
 */
function views_rss_media_help($path, $arg) {
  switch ($path) {
    case 'admin/help#views_rss_media':
      $output = '<p>' . t('This project provides media elements for the <strong>Views RSS</strong> project.') . '</p>';
      if (function_exists('advanced_help_hint_docs')) {
        $output .= '<p>' . advanced_help_hint_docs('views_rss_media', 'https://www.drupal.org/docs/7/modules/views-rss-media-mrss-elements', TRUE) . '</p>';
      }
      else {
        $output .= '<p>' . t('If you install and enable the module <strong>!url</strong>, you will get more help for <strong>Views RSS: Media Elements</strong>.', array(
          '!url' => l('Advanced Help Hint', 'https://www.drupal.org/project/advanced_help_hint'),
        )) . '</p>';
      }
      return $output;
  }
}

/**
 * Implements hook_views_rss_namespaces().
 *
 * Re: https://www.rssboard.org/media-rss#namespace-declaration
 */
function views_rss_media_views_rss_namespaces() {
  $namespaces['media'] = array(
    'prefix' => 'xmlns',
    'uri' => 'http://search.yahoo.com/mrss/',
  );
  return $namespaces;
}

/**
 * Implements hook_views_rss_item_elements().
 */
function views_rss_media_views_rss_item_elements() {
  $elements['media:content'] = array(
    'description' => t('Contains the primary metadata entries needed to index and organize media content.'),
    'preprocess functions' => array(
      'views_rss_media_preprocess_item_content',
    ),
    'help' => 'http://www.rssboard.org/media-rss#media-content',
  );
  $elements['media:title'] = array(
    'description' => t('The title of the particular media object.'),
    'preprocess functions' => array(
      'views_rss_htmlspecialchars',
      'views_rss_media_preprocess_item_text',
    ),
    'help' => 'http://www.rssboard.org/media-rss#media-title',
  );
  $elements['media:description'] = array(
    'description' => t('Short description describing the media object typically a sentence in length.'),
    'preprocess functions' => array(
      'views_rss_htmlspecialchars',
      'views_rss_media_preprocess_item_text',
    ),
    'help' => 'http://www.rssboard.org/media-rss#media-description',
  );
  $elements['media:keywords'] = array(
    'description' => t('Highly relevant keywords describing the media object with typically a maximum of 10 words. The keywords and phrases should be comma-delimited.'),
    'help' => 'http://www.rssboard.org/media-rss#media-keywords',
  );
  $elements['media:thumbnail'] = array(
    'description' => t('Allows particular images to be used as representative images for the media object.'),
    'help' => 'http://www.rssboard.org/media-rss#media-thumbnails',
  );
  $elements['media:category'] = array(
    'description' => t('Allows a taxonomy to be set that gives an indication of the type of media content, and its particular contents.'),
    'preprocess functions' => array(
      'views_rss_media_preprocess_item_category',
    ),
    'help' => 'http://www.rssboard.org/media-rss#media-category',
  );
  return $elements;
}

Functions

Namesort descending Description
views_rss_media_help Implements hook_help().
views_rss_media_views_rss_item_elements Implements hook_views_rss_item_elements().
views_rss_media_views_rss_namespaces Implements hook_views_rss_namespaces().

Constants

Namesort descending Description
VIEWS_RSS_MEDIA_PATH Module installation path.