From the inside-out: How to layer decorators

      Comments Off on From the inside-out: How to layer decorators

This week “Matthew Weier O’Phinney continues his mini-series on using Decorators in Zend_Form”: This time talking about how to layer multiple decorators together to build up the full markup of an element. Potentially with reusable parts!

bq. You may have noticed in the previous installment that the decorator’s render() method takes a single argument, $content. This is expected to be a string. render() will then take this string and decide to either replace it, append to it, or prepend it. This allows you to have a chain of decorators — which allows you to create decorators that render only a subset of the element’s metadata, and then layer these decorators to build the full markup for the element.