From f8edc4bd13e0e8d7115e61fa867dec272accb691 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Mon, 20 Feb 2012 10:30:28 +1300 Subject: [PATCH] MINOR: Add upgrade docs covering the changes to ViewableData --- docs/en/changelogs/3.0.0.md | 14 +++++- .../en/reference/templates-upgrading-guide.md | 46 +++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/docs/en/changelogs/3.0.0.md b/docs/en/changelogs/3.0.0.md index fb3b43c93..7d6e38d44 100644 --- a/docs/en/changelogs/3.0.0.md +++ b/docs/en/changelogs/3.0.0.md @@ -13,9 +13,19 @@ ## Upgrading ## -### New template engine +### New template engine ### -The template engine has been completely rewritten, and although it is generally backward compatible, there are new features and some features have been deprecated. See the [template upgrading guide](/reference/templates-upgrading-guide) and the [template reference](/reference/templates) for more information. +The template engine has been completely rewritten, and although it is generally backward compatible, there are new features +and some features have been deprecated. See the [template upgrading guide](/reference/templates-upgrading-guide) and the +[template reference](/reference/templates) for more information. + +#### Removed view-specific accessors from ViewableData #### + +Several methods in ViewableData that were originally added to expose values to the template language were moved, +in order to stop polluting the namespace. These were sometimes called by project-specific PHP code too, and that code +will need re-working. + +See the [template upgrading guide](/reference/templates-upgrading-guide) for a list of methods and their replacements. ### New user interface for CMS ### diff --git a/docs/en/reference/templates-upgrading-guide.md b/docs/en/reference/templates-upgrading-guide.md index 59ab88170..8038f5c80 100644 --- a/docs/en/reference/templates-upgrading-guide.md +++ b/docs/en/reference/templates-upgrading-guide.md @@ -40,3 +40,49 @@ Within a tag, a single space is equivalent to multiple consequetive spaces. e.g. is equivalent to <% if $Foo %> + + +## Removed view-specific accessors + +Several methods in ViewableData that were originally added to expose values to the template language were moved, +in order to stop polluting the namespace. These were sometimes called by project-specific PHP code too, and that code +will need re-working. + +#### Globals + +Some of these methods were wrappers which simply called other static methods. These can simply be replaced with a call +to the wrapped method. The list of these methods is: + + - CurrentMember() -> Member::currentUser() + - getSecurityID() -> SecurityToken::inst()->getValue() + - HasPerm($code) -> Permission::check($code) + - BaseHref() -> Director::absoluteBaseURL() + - AbsoluteBaseURL() -> Director::absoluteBaseURL() + - IsAjax() -> Director::is_ajax() + - i18nLocale() -> i18n::get_locale() + - CurrentPage() -> Controller::curr() + +#### Iterator-specific + +Some of the removed methods were utilities that exposed the current state of the current scope's iteration. These +currently have no replacement. The list of these methods is: + + - First + - Last + - FirstLast + - Middle + - MiddleString + - Even + - Odd + - EvenOdd + - Pos + - TotalItems + - Modulus + - MultipleOf + +#### Scope-exposing + +Some of the removed methods exposed access to the various scopes. These currently have no replacement. The list of +these methods is: + + - Top