-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Templates to be more modular #37
Comments
The idea was to use the base functionality of SilverStripe where possible. So I was hoping that people would use the templates bundled with the modules as a guide rather than altering the template in the module directly (and manage the module dependency with composer). It's really my intention that devs copy the templates into their theme folder which then takes precedence, that way they can alter the layout etc. as they like. It isn't ideal that some modules' templates override the SwipeStripe module templates but that is core functionality really. I'm not so keen on adding methods in the PHP for managing the template layout really. Perhaps we could make it clearer for devs to copy the template files into their theme folder or even a task that will do so for them? |
I dislike that idea. The 2nd reason is because it makes the point of entry a lot higher. lets think of someone that has not so much experience with SilverStripe, he will most likely have his hands full trying to understand how the other things work, if we force him to also overwrite all templates, he is never going to go with SwipeStripe, because its just out of his scope. perhaps it becomes more clear if I provide a code example; again, the addresses module:
but that's just one idea of implementation, the are other alternatives like introduce a config option that contains a list of templates or something else. |
Currently, many of the SwipeStripe modules just overwrite existing templates, this works well until 2 modules try to overwrite the same file, and one of the modules will not be used.
It also means that the integrity of SwipeStripe + modules is harder to keep clean, because if we change something in a template, we have to change it in all modules that overwrite it as well.
I would like to have a more
$Layout
style approach, to have a base template, and have variables at places where modules can add their content.An example:
the Addresses Module overwrites the whole
AccountPage.ss
template to add the Address information to the Account page.It should be possible to add an Extension to
AccountPage
, with for example a hook calledinsertBeforeContent
orinsertBeforeOrders
, which can return a string that will be injected in the template before the Orders or the Content. (just a starting point, I am sure we will come up with a nicer solution)The text was updated successfully, but these errors were encountered: