-
Notifications
You must be signed in to change notification settings - Fork 35
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
How to use bbcode_clean directly in controller ? #124
Comments
Get 'fm_bbcode.decoda_manager' service in your controller, and use it like here https://github.com/helios-ag/FMBbCodeBundle/blob/master/Templating/BbcodeExtension.php#L79 |
Thanks a lot ! It works but I have a problem with the quote and code tags. When I use the bbcode cleaner, it renders nothing ! EDIT : I have also a question about the emoticons, is it possible to configure them with a emoticons.php file like in decoda ? (https://github.com/milesj/decoda/blob/master/src/config/emoticons.php) |
If you apply bbcode_clean, inside twig template, did this filter strip code/quote tags from your string? About second question: this hook expects yml configuration for emoticons file, another way, is to register custom hook, that will look for your emoticons php file |
About the first question, yes, the filter strips code and quote tags but also the content. I discovered there is an option in decoda : stripContent, I turn it off and now it's perfect ! But I have a problem with the usage of bbcode_clean in a twig view : how can I pass a filterset string in parameter ? |
The same way as bbcode_filter(filterSet) -> bbcode_clean(filterSet) |
Good ! Your bundle is very powerful ! I have one more question... Does it exist a way to avoid line break with decoda manager ? In the decoda documentation, I see options like "setLineBreaks" or "setMaxNewlines" but it doesn't work in the config.yml... |
Well, yes. Option setMaxNewlines is not available. But you can make a PR :) |
Hello @QuozPowa @helios-ag has already responded very well to all questions but I would like to provide some clarifications.
You can also use the
Both PHP and Yaml configuration files are supported (ref). It uses a delegated loader to use the good one. On PHP format the file must return an |
Well explained @alquerci, thank you! |
Yes thank you everyone ! I managed to do what I wanted. Your bundle is very very useful ! 👍 |
I have again another question ! Do you know if it's possible to get the EntityManager in a filter file ? |
Can you explain what goal do you plan to achieve with this, and btw what do you mean under 'filter file'? |
Sorry, I just realize that it is a decoda file (https://github.com/milesj/decoda/blob/master/src/Decoda/Filter/QuoteFilter.php). Actually, I would like to check the author attribute (quote tag) in the database in order to display a link. I can add my own parse method in this filter but the EntityManager isn't available. |
IMHO injecting EM even in filter isn't a good idea, i think this can be achieved with simpler solution, like providing route to user profile. |
Thanks you, I managed to do it :) |
Hello,
I have a new question about your bundle !
I would like to use the bbcode_clean filter directly in a controller, without using any twig view.
I think there is a proper way to call it in a Symfony controller...
The text was updated successfully, but these errors were encountered: