Skip to content

Conversation

@GuySartorelli
Copy link
Member

Mostly documents silverstripe/silverstripe-template-engine#6 but also moves some content into a new section that just talks about the changes to template syntax, since that seems a sensible grouping of information.

Issue

- Arguments are now passed into getter methods when invoked in templates. For example, if a model has a `getMyField(...$args)` method and `$MyField(1,2,3)` is used in a template, the args `1, 2, 3` will be passed in to the `getMyField()` method.
- Values from template variables are passed into functions when used as arguments
- For example, `$doSomething($Title)` will pass the value of the `Title` property into the `doSomething()` method. See [template syntax](/developer_guides/templates/syntax/#variables) documentation for more details.
- The old `<% _t("My_KEY", "Default text") %>` and `<% sprintf(_t("My_KEY", "Default text with %s"), "replacement") %>` i18n syntaxes have been removed. Use the syntax described in the [i18n documentation](/developer_guides/i18n/#usage-in-template-files) instead.
Copy link
Member Author

@GuySartorelli GuySartorelli Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This last line is the only new content. Everything else is just moved.

@emteknetnz emteknetnz merged commit 9030a13 into silverstripe:6.0 Jan 13, 2025
4 checks passed
@emteknetnz emteknetnz deleted the pulls/6.0/remove-old-syntax branch January 13, 2025 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants