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

Make SlugManager available to blade template #3194

Merged
merged 2 commits into from
Dec 12, 2021
Merged

Conversation

imorland
Copy link
Member

@imorland imorland commented Dec 12, 2021

Fixes #0000

I discovered that, it is not possible to use SlugManager within a mail template. Example use case: https://github.com/FriendsOfFlarum/subscribed/blob/be01ea2b2259733c5e59b970e8bb6172243982bc/resources/views/emails/userCreated.blade.php#L5

This template errors if the user slugger is not default.

A solution is ready, but requires this PR: FriendsOfFlarum/subscribed#15

Changes proposed in this pull request:
Make SlugManager available to blade templates

Reviewers should focus on:
I also considered adding an alias, something like flarum.slug.manager here, and resolving from that in the template, but I think the above solution is probably more dev friendly
https://github.com/flarum/core/blob/master/src/Http/HttpServiceProvider.php#L64-L66

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

Copy link
Sponsor Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

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

Yep, this looks good to me! Agreed that there's no need to force demand-time resolution.

@SychO9 SychO9 added this to the 1.2 milestone Dec 12, 2021
@SychO9 SychO9 merged commit 0e00196 into master Dec 12, 2021
@SychO9 SychO9 deleted the im/blade-slugger branch December 12, 2021 19:40
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.

3 participants