helios-ag / FMBbCodeBundle

:capital_abcd: BBCode bundle for Symfony projects
Other
56 stars 35 forks source link

Disable filters/hooks via config.yml? #140

Open alexwybraniec opened 8 years ago

alexwybraniec commented 8 years ago

I would like to disable the Decoda censor hook via config.yml.

The Decoda docs give this example of: $code = new Decoda\Decoda($string); $code->removeHook('Censor');

but I can't see how this could be done in the FMBbCodeBundle.

My current workaround is to amend the Decoda package to return an empty censorship array, but this has meant editing a composer package directly.

Any help greatly appreciated.

alquerci commented 8 years ago

Hello @alexwybraniec

To achieve your goal you can override the default filter sets that is named _default. You can also use a custom filter set.

The minimalist config can be:

fm_bbcode:
  filter_sets:
    _default:
      filters: [ default ]
    my_default:
      filters: [ default, quote ]

The default settings of the _default filter sets come from Decode::default().

I hope this will help you.