dxw / whippet-theme-template

This repo holds the template for a Whippet-enabled theme.
2 stars 1 forks source link

Initialisation #20

Closed mallorydxw closed 8 years ago

mallorydxw commented 8 years ago

At the moment, any code that needs to be called when the theme is initialised has a register() method, and we have to manually add a call to ->register() in the Registrar class.

Upon class instantiation, could we pass an object as the first argument to the constructor, then if the class needs to register anything it calls $object->callMyRegisterMethodLater($this);. Then after all the classes have been instantiated, simply call $object->callAllTheRegisterMethods();.

This would add at least one extra class (or we could just pass the registrar class - that would make sense), but it would mean we would only need to make sure the class gets instantiated and we wouldn't have to worry about calling a hundred 'register()methods in theRegistrar` class.