I have a flag for taxonomy terms and was attempting to use the Rules integration to generate a list of flagged terms using the Fetch content flagged by user action. However, I cannot compare the list of returned flag items with a separate list of taxonomy terms that I have generated.
In the code for the function, it appears the type is set to list (I'm not great with PHP but I got this far):
'flag_fetch_entity_by_user' => array(
'label' => t('Fetch content flagged by user'),
'base' => 'flag_rules_action_fetch_entity_by_user',
'parameter' => array(
'flag' => array(
'type' => 'flag',
'label' => t('Flag'),
),
'flagging_user' => array(
'type' => 'user',
'label' => t('User who flagged the content'),
'description' => t('For non-global flags, this is the user who flagged the content. (For global flags, this argument is ignored.)'),
),
),
'provides' => array(
'content_flagged_by_user' => array(
'label' => t('Content flagged by user'),
'type' => 'list<node>',
),
),
'group' => t('Flag'),
'access callback' => 'flag_rules_integration_access',
),
);I assume that it's fair to assume that this rules component should return entities, not nodes, because it is called flag_fetch_entity_by_user.
Also, for reference, Boriana posted detailed steps on how to confirm this:
1. Create a rule component: /admin/config/workflow/rules/components/
2. Make sure it's a rule or rule set component
3. I have mine accept 'any entity' as a parameter, because I want my original rule to supply it with the 'Fetch content flagged by user' list_item, which this component can check
4. Eventually, you can have it accept a second parameter, which could be a list for it to add to, if the supplied entity is determined to be a type 'taxonomy term'... no need to do this yet, because we'll find out that none of the content passed is of this type. :-(
5. Once you've set the parameters, continue to your rule, and add a condition "**entity is of type**". Set this to 'taxonomy term' and then in an later iteration to 'node' to compare the results of each of these settings
6. I set the action based on the above test to be 'Show a message on the site' for now. This could have been something like 'add item to list' if the above test actually ever was true for terms.
7. Save the rule component, and go back to your original rule where you loop through the content tagged by the user. Add an action IN your loop, in which you call the above component (components appear at the very end of the list) and provide your current list item as the component's parameter.
8. You'll see that only flagged nodes are ever sent to the component, and never terms.
Comments
Comment #0.0
ptmkenny commentedupdated what "doesn't works" means
Comment #1
shabana.navas commentedCould you please confirm that this is still happening in the latest 7.x-3.x version.
Comment #2
joachim commentedComment #2.0
joachim commentedadded why I think it should return entities
Comment #3
ivnish