Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I want to have a rule that delete the Image content wich is referenced to the gallery. So I add a rule but this rule does not work. I attches the rule. Did someone see a mistake?
Thanks in advanced!
Frank
Here is the rule:
{ "rules_delete_a_gallery" : {
"LABEL" : "Delete a gallery",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_delete" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "node_image_gallery" : "node_image_gallery" } }
}
}
],
"DO" : [
{ "entity_query" : {
"USING" : {
"type" : "node",
"property" : "node_gallery_ref_1",
"value" : [ "node" ],
"limit" : "100"
},
"PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
}
},
{ "LOOP" : {
"USING" : { "list" : [ "entity-fetched" ] },
"ITEM" : { "list_item" : "Current list item" },
"DO" : [ { "entity_delete" : { "data" : [ "list-item" ] } } ]
}
},
{ "drupal_message" : { "message" : "Images [entity-fetched:0] which have been a reference to the deleted gallery were also deleted." } }
]
}
}
Comments
Comment #1
fraweg CreditAttribution: fraweg commentedComment #2
fraweg CreditAttribution: fraweg commented... is this a stupid question? Did someone have working rules with this module?
Best regards
Frank
Comment #3
zengenuity CreditAttribution: zengenuity commentedComment #4
fraweg CreditAttribution: fraweg commentedHello zengenuity,
you save my day! Thanks so much!
Best regards
Frank