Hi,
I am working on a new project that heavily relies on feeds. Currently I import using a json parser and create new "Video Asset" Nodes (Works great). I have another Feeds Importer (Asset Social Stats) attached to the "Video Asset" nodes, and the feeds url is dynamically populated using feeds tamper (Also works great!).
Now if I visit each "Video Asset" node I can click the "Import" tab, and then the "Import" button, and it works fine (Using Feeds Node Self Processor). Populating all fields as expected.
My problem is making the import hands free. Ideally I would like to trigger the import on a specific node using rules.
(Example: Event = When Content Is Viewed, Condition = Last Updated More Than 24hrs Ago, Action = Import Feed Attached To %Nid).
However I can't seem to find an action to import anywhere in rules. I have searched high and low through the forums and google.
Any suggestions? THank you!
Comment | File | Size | Author |
---|---|---|---|
#10 | feeds-rules-feed-node-description.png | 22.56 KB | MegaChriz |
#10 | interdiff-2446307-06-10.txt | 3.03 KB | MegaChriz |
#10 | feeds-rules-import-action-2446307-10.patch | 9.11 KB | MegaChriz |
| |||
#6 | interdiff-2446307-3-6.txt | 8.38 KB | MegaChriz |
#6 | feeds-rules-import-action-2446307-6.patch | 7.58 KB | MegaChriz |
|
Comments
Comment #1
2ndChanceTech CreditAttribution: 2ndChanceTech commentedLooks like I'm closer to getting this to work, unfortunately it will be done using PHP in rules (Not my preferred method). If someone has another suggestion not needing php in rules, please advise.
I found this in the Feeds Developers guide, but know nearly nothing about PHP, so not sure how to implement it....
I replaced "my_importer_id" with the machine name of my importer and "nid" with the rules replacement pattern. but can't seem to get it to trigger.
Comment #2
2ndChanceTech CreditAttribution: 2ndChanceTech commentedAccidentally closed thinking I had figured it out... Re-opening...
Comment #3
MegaChriz CreditAttribution: MegaChriz commentedI have been playing with this as well, see the attached patch. The patch adds a Rules action "Execute feeds importer" which will trigger the import of a source. The problem with this solution is that you have to go trough the import form at least once, otherwise Feeds doesn't know from which source you want to import. (I do not remember how I came to the code in
feeds_action_import_feed()
, I made this more than a year ago.)There is also a huge patch about Rules integration in the following issue:
#713122: Rules Integration / Working with the feeds field
I haven't tested that one, but it is at least related.
Comment #4
liquidcms CreditAttribution: liquidcms commentedWorks great. Thanks MegaChriz.
Comment #5
g33kg1rl CreditAttribution: g33kg1rl commentedThis patch applied with offset -3 and none of the options are showing up with I select the execute feeds option. Can chance this can be rerolled for the latest version?
Comment #6
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThis patch uses a different approach for implementing this feature. Compared to the patch in #3, the advantages are the following:
Also added three automated tests:
Comment #7
g33kg1rl CreditAttribution: g33kg1rl commentedThanks for the new patch MegaChriz. It works for me! :D
Comment #8
firfin CreditAttribution: firfin commented@Megachriz, thanks so much for taking a stab at this!
Still applies to latest dev without issue. And there is an action available to run an importer. Dropdown list to select feeds importer works. Unfortunately feeds_node is also a required field? I am using a standalone importer, so really do not have a clue what to put into this field?
Comment #9
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedI thought I had already committed this one ages ago! I'll schedule to look at this one again. Hopefully I can do that somewhere this month, cause anything Feeds D8 related has first priority.
@firfin
You can use the action for importers using a standalone form as well. For importers *not* attached to a content type, the feed nid is always
0
, so I suppose putting in a zero should work. Suggestions (patches) for improvements are welcome. Ideally, you wouldn't see the Feed node field for importers using a standalone form.Comment #10
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedCoding standards. Also added a description to the "Feed node" parameter that a 0 must be provided if the importer is not attached to a content type.
Comment #12
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedCommitted #10.
Comment #13
firfin CreditAttribution: firfin commentedStill works. And yes, using a 0 as feed node id works indeed.
Quick pick up on this BTW, seeing as how busy you are with D8.
Comment #15
tboggia CreditAttribution: tboggia commentedStruggling a bit with this. I have the Rule set up to "Execute feeds importer", but I cannot set any of the parameters at all, let alone set them based on what node triggered the rules. What I'm trying to do is:
What works:
What doesn't work:
Thoughts on how I can make this work?
Comment #16
kopeboy CreditAttribution: kopeboy commentedIs any of this supported in Drupal 8/9?