Remove Links Trigger


(Nic Hubbard) #1

In working with the remove links trigger, it seems there is a need for an additional Parameter that dynamically replaces the "As linked to the Broadcasting Asset, which also resides under the Root Node", so, essentially the root node. In my case, I want to use the current user, so, in /core/assets/system/triggers/trigger_action_types/trigger_action_remove_links I am editing trigger_action_remove_links.inc.


On line 352, I have added:


    $attr_parameter_map->setParameter('root', 'Root Node');


After adding that, the new option shows up in the Remove Links trigger parameters.

My questions is, where in the trigger_action_remove_links.inc file, is the code that corresponds to the "As linked to the Broadcasting Asset, which also resides under the Root Node" root node, which I want to replace with the newly added "root" parameter? I can't seem to find it.

Any suggestions or help on this would be wonderful!

(Mark Brydon) #2

[quote]In working with the remove links trigger, it seems there is a need for an additional Parameter that dynamically replaces the "As linked to the Broadcasting Asset, which also resides under the Root Node", so, essentially the root node. In my case, I want to use the current user, so, in /core/assets/system/triggers/trigger_action_types/trigger_action_remove_links I am editing trigger_action_remove_links.inc.


On line 352, I have added:


    $attr_parameter_map->setParameter('root', 'Root Node');


After adding that, the new option shows up in the Remove Links trigger parameters.

My questions is, where in the trigger_action_remove_links.inc file, is the code that corresponds to the "As linked to the Broadcasting Asset, which also resides under the Root Node" root node, which I want to replace with the newly added "root" parameter? I can't seem to find it.

Any suggestions or help on this would be wonderful![/quote]
Proabably not the best translation, but the contents of this fields is written out as part of the locale string "trigger_remove_link_basic".
Each of these translate() calls also takes an argument or two for the relevant form fields.

This interface is set up and returned from line 377 (line begins with "$contents = ").

(Nic Hubbard) #3

[quote]Proabably not the best translation, but the contents of this fields is written out as part of the locale string "trigger_remove_link_basic".
Each of these translate() calls also takes an argument or two for the relevant form fields.



This interface is set up and returned from line 377 (line begins with "$contents = ").[/quote]



Mark, I have understood that so far. The part I am interested in is $basic_part_4 which contains the parameter map. When adding a new parameter map item, $attr_parameter_map->setParameter('root', 'Root Node');, how do I associate code to this, to make that selection function and override the default "As linked to the Broadcasting Asset, which also resides under the Root Node"?


(Mark Brydon) #4

Gotcha. The execute() function obtains the value set from the Parameter Map, should there be a matching GET / POST etc. value for an item.

This is demonstrated for the "Candidate Assets" item which is obtained from the Parameter Map on line 76:

    $map_assetid = $attr_parameter_map->getParameterValue('asset');

If this value is NULL, then the Trigger Action should defer to the static Root Node. In keeping with other areas of Matrix which use dynamic root nodes, I would recommend checking that the supplied dynamic root node resides underneath the static one and failing the action should this not be the case. I hope this helps out.


(Nic Hubbard) #5

[quote]Gotcha. The execute() function obtains the value set from the Parameter Map, should there be a matching GET / POST etc. value for an item.
This is demonstrated for the "Candidate Assets" item which is obtained from the Parameter Map on line 76:

    $map_assetid = $attr_parameter_map->getParameterValue('asset');

If this value is NULL, then the Trigger Action should defer to the static Root Node. In keeping with other areas of Matrix which use dynamic root nodes, I would recommend checking that the supplied dynamic root node resides underneath the static one and failing the action should this not be the case. I hope this helps out.[/quote]



Ah, I see. I am starting to wrap my mind around this. Thanks!