Skip to content
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

DOC Document changes to template functionality #669

Open
wants to merge 1 commit into
base: 6.0
Choose a base branch
from

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.

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.

1 participant