Nested Actions

I’m thinking about Thomas Kimmich’s question about WordPress on the main list, and the Template Helper Action in that context. It seems that if you have nested applications of the Action, only the outermost instance will have any effect. Thinking about it in the abstract, I think that I need to create a tree structure, then reverse it, and then run the removal as the very last step.

I’ve determined that the fwPage.fwFindAllActions() method returns an array in outer-to-inner order, so I can reverse that and have my order of operations. But how do I call the Actions on each item in that order?

When I did the first generation of Scripty Actions, we had this whole registration scheme, where each Action would indicate that it was part of the “Scripty” club, and only the last instance on the page (in publish order) would fire off the linking code to add the libraries to the head of the page. I’d like to avoid that here if possible.

Can anyone suggest a way to fire an Action’s fwAfterEndHTML() method from outside of itself?

Walter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,
If I understand you correctly then you want to run the outermost Action on a stack of items and prevent all of the child Actions from running. I’d be inclined to have each Action call a function that recursively looks at the parent item and searches for all named Actions on that stack. You should be able to weed out the current Action from the returned selection. Once you’ve hit the top of the stack you should have a reference to the top-most Action as well as a list of all of the child Actions. From here you can then tell each child to deactivate.

If you do this early on in the publishing process only the top most Action should do any work.
This is all hypothetical at the moment and works like a charm in my mind but it should be doable in reality. Maybe. :slight_smile:
Regards,
Tim.

On 5 Feb 2014, at 16:06, Walter Lee Davis wrote:

I’m thinking about Thomas Kimmich’s question about WordPress on the main list, and the Template Helper Action in that context. It seems that if you have nested applications of the Action, only the outermost instance will have any effect. Thinking about it in the abstract, I think that I need to create a tree structure, then reverse it, and then run the removal as the very last step.

I’ve determined that the fwPage.fwFindAllActions() method returns an array in outer-to-inner order, so I can reverse that and have my order of operations. But how do I call the Actions on each item in that order?

When I did the first generation of Scripty Actions, we had this whole registration scheme, where each Action would indicate that it was part of the “Scripty” club, and only the last instance on the page (in publish order) would fire off the linking code to add the libraries to the head of the page. I’d like to avoid that here if possible.

Can anyone suggest a way to fire an Action’s fwAfterEndHTML() method from outside of itself?


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options