I am trying to attack this problem from a completely different angle, because it doesn’t look like I can achieve my goal that way.
I want to loop over the item stack in the HeadScript View Helper, and make modifications to it. The documentation for this and some of the other view helpers makes this statement:
HeadScript overrides each of append(),
offsetSet(), prepend(), and set() to
enforce usage of the special methods
as listed above. Internally, it stores
each item as a stdClass token, which
it later serializes using the
itemToString() method. This allows
you to perform checks on the items in
the stack, and optionally modify these
items by simply modifying the object
returned.
So, where is this “object returned”? I am missing a piece of the puzzle here.
Thanks for your help!
In the
toString()method ofZend_View_Helper_HeadScriptI noticed aforeach()loop on$this, so I tried that and it worked. Here’s a HeadScript extension I wrote that illustrates the solution:In
Bootstrap.phpthe following lines to point to my helpers:In my layout, I have this line:
If my solution is unclear in any way, let me know and I’ll update it to clarify.