ucla-oarc-mobile / mwf

UCLA Mobile Web Framework
http://mwf.ucla.edu
Other
86 stars 25 forks source link

Where to place an extension of the Tag_HTML_Decorator class #166

Closed mirie closed 11 years ago

mirie commented 11 years ago

Hi,

I've created a custom Header_Site_Decorator that extends the Tag_HTML_Decorator class. Where should I put this extension? Should it go in /root/assets/lib/decorator/site?

Thanks!

ebollens commented 11 years ago

@mirie you can't create another Header_Site_Decorator class itself. Doing so could create a naming conflict, as there's already a Header_Site_Decorator in MWF. To avoid merge conflicts later, rather than modifying the MWF one directly, I recommend just coming up with a different name.

As for location, you are right on /root/assets/lib/decorator/site. The Site_Decorator should be able to auto-load it from there. You might also want to define this function in the Site_Decorator class (optional) to allow you to call a static factory to construct it (technically it will work without you defining the actual function given the definition of __callStatic but method-hinting won't work unless you define the method explicitly as well - take a look at how the others are implemented in that class).