-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Twig] Remove deprecated tag usage #33662
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
Q | A |
---|---|
Branch? | 4.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | n/a |
License | MIT |
Doc PR | n/a |
fabpot
referenced
this pull request
Sep 22, 2019
This PR was merged into the 4.4 branch. Discussion ---------- [Twig] Add NotificationEmail | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | - This PR is an extract of the new Notifier component. It's a default template to send standardized emails with the Mailer component, which can be used independently of the Notifier component. Such emails look like the following: <img width="618" alt="image" src="https://user-images.githubusercontent.com/47313/65018883-694cb780-d92a-11e9-940a-875ea68f9e5d.png"> More info on SpeakerDeck (be warned that names have change since my presentation): https://speakerdeck.com/fabpot/symfony-notifier?slide=7 It requires Twig 1.12 which should be released later this week. Usage example: ```php $email = (new NotificationEmail()) ->from('fabien@example.com') ->to('fabien@example.org') ->subject('My first notification email via Symfony') ->markdown(<<<EOF There is a **problem** on your website, you should investigate it right now. Or just wait, the problem might solves itself automatically, we never know. EOF ) ->action('More info?', 'https://example.com/') ->importance('high') //->exception(new \LogicException('That does not work at all...')) ; ``` Instead of `markdown()`, you can also use `content()` for simple emails. Note that you can use Inky tags in the content: ```php $email = (new NotificationEmail()) ->from('fabien@example.com') ->to('fabien@example.org') ->subject('My first notification email via Symfony') ->markdown(<<<EOF There is a **problem** on your website, you should investigate it right now. Or just wait, the problem might solves itself automatically, we never know. Some Title ========== <center> <button href="https://example.com/">Go?</button> </center> EOF ); ``` There is also the concept of a theme. By default, it uses the `default` theme, which is an alias for the `zurb_2` theme. You can use `setTheme()` to override the theme for a given instance, or override the themes globally via the following config in `twig.yaml`: ```yaml twig: paths: templates/email: email ``` Then, create `templates/email/default/notification/body.html.twig` and `templates/email/default/notification/body.txt.twig`. Extends the existing template via `{% extends "@!email/default/notification/body.html.twig" %}` (note the `!`). Commits ------- f6c6cf7 [Twig] Add NotificationEmail
yceruto
approved these changes
Sep 23, 2019
xabbuh
approved these changes
Sep 23, 2019
maxhelias
approved these changes
Sep 23, 2019
stof
approved these changes
Sep 23, 2019
Should we add a test rendering a notification email ? This way, the testsuite would catch such deprecation, as well as any issue in the template. |
fabpot
added a commit
that referenced
this pull request
Sep 23, 2019
This PR was merged into the 4.4 branch. Discussion ---------- [Twig] Remove deprecated tag usage | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT | Doc PR | n/a <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> Commits ------- cd74cb3 [Twig] Remove deprecated tag usage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.