Commit 844ec898 authored by merlinofchaos's avatar merlinofchaos

#116985: Fix channel link in RSS feeds. #116985: Fix channel link in RSS feeds.

parent baabcc08
......@@ -112,9 +112,11 @@ Views 4.7.x-dev
o #103649: Documentation fix fix for date granularity
o #119742: Improved handling of DISTINCT; allow DISTINCT to not kill summaries.
o #111936: Allow search keyword to be optional.
o #116985: Fix channel link in RSS feeds.
New features:
o #105620: (Attempt 2) allow modules to alter views tables + arguments
o #111210: Create user filter by role to make it easier to manage users.
o #115125: Allow use of file descriptions rather than just file names in attached files
o #115856: Allow use of autocomplete for freetagging taxonomies.
o Allow RSS channel description to be set as part of the argument option.
......@@ -317,7 +317,8 @@ function node_views_arguments() {
'node_feed' => array(
'name' => t('Node: Feed Selector'),
'handler' => 'views_handler_arg_node_feed',
'help' => t('This argument allows pluggable "feed" selectors. If using views_rss module, "feed" will turn the view into an RSS feed. Other modules may provide their own feeds.'),
'option' => 'string',
'help' => t('This argument allows pluggable "feed" selectors. If using views_rss module, "feed" will turn the view into an RSS feed. Other modules may provide their own feeds. You may enter the title the feed will advertise in the title field here. If the feed type offers a description, enter the description of the feed in the option field here.'),
),
);
return $arguments;
......@@ -352,12 +353,13 @@ function node_views_default_views() {
'options' => '',
),
);
$view->argument = array (
array (
'type' => 'node_feed',
'argdefault' => '2',
'title' => '',
'options' => '',
'title' => variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', ''),
'options' => variable_get('site_mission', ''),
'wildcard' => '',
'wildcard_substitution' => '',
),
......@@ -758,7 +760,7 @@ function views_handler_arg_node_feed($op, &$query, $argtype, $arg = '') {
// $view.
foreach (module_implements('views_feed_argument') as $name) {
$function = $name .'_views_feed_argument';
$function('argument', $GLOBALS['current_view'], $arg);
$function('argument', $GLOBALS['current_view'], $arg, $argtype);
}
}
}
......
......@@ -33,7 +33,8 @@ function views_rss_views_arguments() {
'rss_feed' => array(
'name' => t('RSS: RSS Feed Selector'),
'handler' => 'views_handler_arg_rss_feed',
'help' => t('This argument specifies a specific RSS feed selector; it will only select RSS feeds, unlike the built-in selector which can select pluggable feeds.'),
'option' => 'string',
'help' => t('This argument specifies a specific RSS feed selector; it will only select RSS feeds, unlike the built-in selector which can select pluggable feeds. You may enter the title the feed will advertise in the title field here, and the description of the feed in the option field here.'),
),
);
return $arguments;
......@@ -52,7 +53,7 @@ function views_handler_arg_rss_feed($op, &$query, $argtype, $arg = '') {
case 'filter':
// This is a clone of the default selector, but it just invokes ours
// rather than calling all of them.
views_rss_views_feed_argument('argument', $GLOBALS['current_view'], $arg);
views_rss_views_feed_argument('argument', $GLOBALS['current_view'], $arg, $argtype);
}
}
......@@ -77,9 +78,29 @@ function views_rss_views_post_view($view, $items, $output) {
* the 4th argument isn't part of the hook, but we use it to differentiate
* when called as a hook or when called manually from views_rss_views_post_view
*/
function views_rss_views_feed_argument($op, &$view, $arg) {
function views_rss_views_feed_argument($op, &$view, $arg, $argdata = NULL) {
if ($op == 'argument' && $arg == 'feed') {
$view->page_type = 'views_rss';
if ($argdata['options']) {
$view->description = $argdata['options'];
}
// reset the 'real url' to the URL without the feed argument.
$view_args = array();
$max = count($view->args);
foreach ($view->args as $id => $view_arg) {
++$count;
if ($view_arg == $arg && $view->argument[$id]['id'] == $argdata['id']) {
if ($count != $max) {
$view_args[] = $argdata['wildcard'];
}
}
else {
$view_args[] = $view_arg;
}
}
$view->feed_url = views_get_url($view, $view_args);
}
else if ($op == 'post_view') {
$args = views_post_view_make_args($view, $arg, 'feed');
......@@ -111,7 +132,7 @@ function theme_views_rss_feed($view, $nodes, $type) {
$channel = array(
'title' => views_get_title($view, 'page'),
'link' => url($view->real_url, NULL, NULL, true),
'link' => url($view->feed_url ? $view->feed_url : $view->real_url, NULL, NULL, true),
'description' => $view->description,
);
......@@ -170,9 +191,6 @@ function theme_views_rss_feed($view, $nodes, $type) {
$channel_defaults = array(
'version' => '2.0',
'title' => variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', ''),
'link' => $base_url,
'description' => variable_get('site_mission', ''),
'language' => $GLOBALS['locale'],
);
$channel = array_merge($channel_defaults, $channel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment