-
-
Notifications
You must be signed in to change notification settings - Fork 600
Add a modify() helper for use in Blade #2717
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
Conversation
This adds a nice helper function for people using Blade, which allows for `{{ modify($value)->nl2br() }}` for example
|
With the trend being against global functions, I'm hesitant to add this. Especially with such a generic name. 🤔 It's a good idea though. I wonder if there's a better solution? |
|
This feels to me like the |
|
It is only a one-liner though, so maybe it would be enough to just add it to the docs and people can add it to their projects if they need it |
|
I would like this helper a lot, but do see Jasons point. It may be possible or nice having more helper functions. So what about a statamic_FUNCTION naming. In this case: statamic_modify() Still global, but less generic. |
|
I've added a PR to the docs: statamic/docs#290 |
|
I think this would be a nice add. Especially since it’s SO generic outside of the “modifier” namespace that any other global function would probably a noun attached. Eg “modifySomething”. |
|
@jackmcdade I agree with your reasoning here. But do you feel the same way about |
|
Gonna hold off on this for now and suggest devs plop it in their own helpers file. Thanks! |
This adds a nice helper function for people using Blade, which allows for
{{ modify($value)->nl2br() }}for example