type; $form['workflow']['audio_feeds_attach'] = array( '#type' => 'radios', '#title' => t('Audio Feeds'), '#default_value' => variable_get('audio_feeds_attach_'. $type, 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Provide XSPF, M3U, and PLS feeds for attached audio nodes.'), ); } break; } } /** * Implementation of hook_link(). */ function audio_feeds_link($type, $node = NULL, $teaser = FALSE) { global $base_url; global $user; $links = array(); if (variable_get('audio_feeds_attach_'. $node->type, 0)) { // Add audio playlist feed links. $feed_links = variable_get('audio_feeds_feed_links', array('m3u', 'pls', 'xspf')); foreach ($feed_links as $key => $type) { switch ((string)$type) { case 'm3u': $links['audio_feeds_m3u_link'] = array( 'title' => t('M3U'), 'href' => "node/$node->nid/m3u", 'attributes' => array('title' => t('Stream M3U feed')), ); break; case 'pls': $links['audio_feeds_pls_link'] = array( 'title' => t('PLS'), 'href' => "node/$node->nid/pls", 'attributes' => array('title' => t('Stream PLS feed')), ); break; case 'xspf': $links['audio_feeds_xspf_link'] = array( 'title' => t('XSPF'), 'href' => "node/$node->nid/xspf", 'attributes' => array('title' => t('Shareable XSPF feed')), ); break; } } } return $links; } /** * Implementation of hook_menu(). */ function audio_feeds_menu() { $items = array(); $items['node/%node/xspf'] = array( 'title' => 'XSPF', 'page callback' => 'audio_feeds_xspf', 'page arguments' => array(1), 'access callback' => 'audio_feeds_access', 'access arguments' => array(1), 'file' => 'audio_feeds.feeds.inc', 'type' => MENU_CALLBACK, ); $items['node/%node/m3u'] = array( 'title' => 'M3U', 'page callback' => 'audio_feeds_m3u', 'page arguments' => array(1), 'access callback' => 'audio_feeds_access', 'access arguments' => array(1), 'file' => 'audio_feeds.feeds.inc', 'type' => MENU_CALLBACK, ); $items['node/%node/pls'] = array( 'title' => 'PLS', 'page callback' => 'audio_feeds_pls', 'page arguments' => array(1), 'access callback' => 'audio_feeds_access', 'access arguments' => array(1), 'file' => 'audio_feeds.feeds.inc', 'type' => MENU_CALLBACK, ); $items['admin/settings/audio/feeds'] = array( 'title' => 'Feeds', 'page callback' => 'drupal_get_form', 'page arguments' => array('audio_feeds_admin'), 'access arguments' => array('administer audio'), 'file' => 'audio_feeds.admin.inc', 'type' => MENU_LOCAL_TASK, ); return $items; } /** * Menu access callback. */ function audio_feeds_access($node) { return variable_get('audio_feeds_attach_'. $node->type, 0); }