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
Template global fixes #247
Conversation
…ntexts (e.g. $Now.Year) BUGFIX: Allow template globals to return objects as well as values.
API CHANGE: Move Controller::PastMember() to Member::is_repeat_member() in code. API CHANGE: Removed Controller::CurrentMember(), it was only ever intended as a template global provider.
…global provider, and use the new TemplateGlobalProvider interface on SS_Datetime instead.
Will close http://open.silverstripe.org/ticket/3943 |
Hmm. Looks ok. Don't really like "getObj" as a name, but can't think of something better, given the copy-pasta needed to make _DataPresenter override obj itself. Only thing to check is that if a DataObject has a getObj method then $Obj works - I think it should, but best to check. |
I might rename the method to something else. I'll add a test for the edge case you suggest. |
@sminnee Can you try to get those tests written (and the method renamed) this week so we can still get this pull request into beta2? |
@sminnee @hafriedlander Are you OK with merging this in without tests? Unless Sam can write them in the next ~10h I don't see how that'd get into beta2 :) |
Umm. It looks OK? It need rechecking against the changes I made last week re: passing arguments into includes to make sure tests still pass. |
It'd be great to get this in before beta3. |
…ined-to-the-wrong-type Fix incorrect data type obtained sometimes through html dataset
@hafriedlander - this is one for you to review. The TemplateGlobalProvider didn't let you create objects. I have attempted to solve that it and it both seems to work and passes the tests, but should probably still review it.
It means that we can make $Now a template global, and still have $Now.Year work.