Comments (6)
This configuration would also be appreciated on SF bridge.
Something like this or anything that allow us to addRule for simple cases.
cocur_slugify:
separator: "_"
rulesets:
- default
- [".",""]
from slugify.
@nei This would be the correct approach for solving this.
When we are talking about just the Twig integration because it could be part of the SF bridge, but it could also mean just straight-up Twig.
Alternatively for Twig we could add a slugfiy_add_rule
tag to allow editing rules. I would prefer not to change the call for slugify
because I think it should match the PHP methods signature.
from slugify.
You should call addRules()
on the Slugify object before you inject it to the Cocur\Slugify\Bridge\Twig\SlugifyExtension
constructor.
from slugify.
That's correct. but will only work if we know the rule to be added.
instead the scenario i am talking about is when the rule is not known and will be passed from the twig template.
So something like:
{{name | slugify(null, {'&': 'and'}) }}
As, you can see here the php level code doesn't know the rule but will be passed from template
Regards,
from slugify.
@florianeckerstorfer adding a tag would be a better option ...
I was more talking about the scenario where the Frontend guys don't know anything about the backend and have no knowledge about the configurations, in that scenario they can just pass and new rules directly from the twig template and no change in the backend will be required
from slugify.
@harsain Putting this kind of logic inside your template seems like a good idea to get unmanageable code.
from slugify.
Related Issues (20)
- Generated ruleset different from the json file HOT 1
- Symfony Bundle ignores ruleset HOT 1
- Problem with combining characters HOT 2
- There is any options to convert in Unicode symbols to description HOT 3
- User Deprecated HOT 5
- Issue with usage, example doesnt work after installing with composer HOT 3
- how to get slug without translation HOT 1
- Laravel 9 Support HOT 3
- Sign « changes on quot HOT 1
- Split DefaultRules into deparate files
- Add command-line interface to this package? HOT 1
- release for php 8.2 HOT 2
- Remove reserved characters like ­ and
- New release does not work on PHP 7.4 HOT 2
- The version 4.4.0 have been removed from Packagist? HOT 3
- Requirements Version 4.5 HOT 2
- version 4.5.0 is not compatible with PHP 7 although mentioned in packagist HOT 3
- Czech rules missing several characters
- Syntax error, unexpected '|', expecting variable {t_variable} HOT 3
- Issue with Php Composer (Slugify)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slugify.