Needs review
Project:
Advanced Views RSS Feed
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Jan 2013 at 02:40 UTC
Updated:
6 Sep 2016 at 13:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dandaman commentedThis would be nice. For example, I'd like it to create a podcast feed for every item in the taxonomy, so if it could take some fields of the first row and use them to populate the channel fields, that would make this so I don't have to create a separate view display for each feed.
Comment #2
dandaman commentedSpeaking of which, is it even possible to make the Core elements set from a field within the row results? I was trying to go through the code to see if that's doable, but I'm not sure if I see how this could be done by adding some code even within the framework of this module so far. Maybe I'm missing something, though.
Also, I'd like to do this on 7.x-2.x, not 6.x-2.x, but I think it's mostly the same thing anyways, right?
Comment #3
lzimmerman commentedI have been looking at this for the 7.x version, and have the start of a (hacky) solution.
In views_rss_core.inc (Core Elements preprocessing section), I have added this function:
Then in element preprocessors, we can use the function to check for a token:
check_replacement_patterns($variables, $variables['elements'][0]['value']);For example, an altered preprocessor:
Other element preprocessors (categories, image) may need more tweaking, but maybe this example can serve as a jumping-off point.
I would guess that a similar function would work for 6.x also.
(N.B.: The end of the URL for a Fields item is likely the token text to use in brackets, e.g. 'body_1' or 'nid'.)
Comment #4
dandaman commentedNice! That might be a good start on a patch to make it a real feature and not a hack.
Comment #5
lzimmerman commentedI used this function as a starting point for including replacement patterns for almost all channel elements, and the result looks to be a success so far.
The code feels pretty messy, though - I don't know whether it's patch-worthy at this point. As it is I have several replacements tossed around several files in the Views RSS and Views RSS iTunes modules.
Maybe if a preprocess function could be run on *all* text-field-based Views RSS fields, just running the check_replacement_patterns() function and then moving on to any standard preprocessing.
Such an approach that might need just two short additions - the function itself and an extra field preprocessor running the function.
Comment #6
rtdean93 commented@lzimmerman - Can you provide a patch or document what you have done? I need this for my D7 taxonomies.
Thanks
Bobby
Comment #7
lzimmerman commentedHi Bobby,
The code in this thread is what we used, adjusted to suit the different fields that needed to allow views field tokens. Some of ours involved hard-coding site-specific data, which makes the code non-transferrable.
But most fields just used the model already described (example is for the "description" field):
1. Create a function to check for views replacement patterns.
2. Adjust the preprocessor for each field that should require tokens.
You can add any extra cleanup or alteration in the preprocessor function also.
Comment #8
kenheim commentedI'd like to see this feature added. It would make creating multiple feeds so much simpler.
Comment #9
maciej.zgadzaj commentedUsing row values for channel elements is not logical to make it into the module, therefore for this part the issue status is "won't fix".
Regarding tokens, I would be happy to apply a patch if anyone submits one (as with any feature request, which this is really). Please feel free to reopen this issue when providing a patch.
Comment #10
pookmish commentedMaybe this will work. I'm using 2 contextual filters on a rss feed and i'm able to populate the description & other fields based on a field on the rows. I only got it to pull the data for the last row. If i get time i'll work on it a little more. but it solves this issue for me right now.
Comment #11
sgdev commented@maciej.zgadzaj, attached is a patch for review only including tokens. This leverages Token's
token_treeto define basic options (site, current user, etc.), and then appends tokens for any entities included in the View (node, user, etc.).I'm using
token_treerather thantoken_tree_linkbecause of the problems that occur trying to load an Ajax-based window in Views when using live preview.Also leveraged the regex used by Token to perform matches, and cleaned up the
_validatefunction a bit.Let me know your feedback, thanks.
Comment #12
sgdev commentedAfter performing some further testing, realized there were a few additional places the token support needed to be added to preprocess functions. We've now created a central
views_rss_token_replacefunction that is used in each location.Please review the attached files. Thanks.