Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Version 2.0 (08/2018)

* Added compatibility for Symfony 5 and Twig 3
* Updated minimum requirement of Twig to 1.35 and 2.4 to support runtime
* [BC break] Dropped support for Symfony 2. Symfony 3.4 minimum required.
* [BC break] Removed classes parameters.
* [BC break] Removed the form data transformer.
* Added an `HTMLPurifierTextTypeExtension` to add `purify_html` and
`purify_html_profile` options to all `TextType` children.
* Added an `HTMLPurifierListener` to purify submitted form data.
* Added an `HTMLPurifiersRegistryInterface` to lazy load purifiers by profile.
* Added a Twig `HTMLPurifierRuntime` to lazy load purifiers in templates.
* Added a pass to use custom `\HTMLPurifier` classes as custom profiles using
a new `exercise.html_purifier` tag.
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ exercise_html_purifier:
Cache.SerializerPath: '%kernel.cache_dir%/htmlpurifier'
```

The `default` profile is special in that it is used as the configuration for the
`exercise_html_purifier.default` service as well as the base configuration for
other profiles you might define.
The `default` profile is special, it is *always* defined and its configuration
is inherited by all custom profiles.
`exercise_html_purifier.default` is the default service using the base
configuration.

```yaml
# config/packages/exercise_html_purifier.yaml
Expand All @@ -115,13 +116,24 @@ this in you `app/config/services.yml` or `config/services.yaml`:
services:
# ...

\HTMLPurifier:
alias: exercise_html_purifier.custom

# or the equivalent as of Symfony 3.3
\HTMLPurifier: '@exercise_html_purifier.custom'
exercise_html_purifier.default: '@exercise_html_purifier.custom'
```

## Using a custom purifier class as default

If you want to use your own class as default purifier, define a new alias:

```yaml
# config/services.yaml
services:
# ...

exercise_html_purifier.default: '@App\Html\CustomHtmlPurifier'
```

In such case, the custom purifier will use its own defined configuration,
ignoring the bundle configuration.

## Form Type Extension

This bundles provides a form type extension for filtering form fields with
Expand Down Expand Up @@ -212,5 +224,7 @@ $builder
{{ html_string|purify('custom') }}
```

Your class will inherit the default config or the one from the same profile
used in the tag.
## Contributing

PRs are welcomed :). Please target the `2.0` branch for bug fixes and `master`
for new features.