Skip to content
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

Add possibility to declare and apply presets to behavior #91

Open
ohader opened this issue Oct 19, 2022 · 0 comments
Open

Add possibility to declare and apply presets to behavior #91

ohader opened this issue Oct 19, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@ohader
Copy link
Member

ohader commented Oct 19, 2022

use TYPO3\HtmlSanitizer\Behavior;
use TYPO3\HtmlSanitizer\Builder\Preset\IframePreset;

$behavior = (new Behavior())
    ->withFlags(Behavior::ENCODE_INVALID_TAG | Behavior::REMOVE_UNEXPECTED_CHILDREN)
    ->withName('scenario-test')
    ->withPreset(new IframePreset());
@ohader ohader added the enhancement New feature or request label Oct 19, 2022
ohader added a commit to ohader/html-sanitizer that referenced this issue Oct 20, 2022
Example (uses preset declaring `<iframe>` and applies it):

```php
use TYPO3\HtmlSanitizer\Behavior;
use TYPO3\HtmlSanitizer\Builder\Preset\IframePreset;

$behavior = (new Behavior())
    ->withFlags(Behavior::ENCODE_INVALID_TAG | Behavior::REMOVE_UNEXPECTED_CHILDREN)
    ->withName('scenario-test')
    ->withPreset(new IframePreset());
```

Related: TYPO3#91
ohader added a commit to ohader/html-sanitizer that referenced this issue Oct 20, 2022
Example (uses preset declaring `<iframe>` and applies it):

```php
use TYPO3\HtmlSanitizer\Behavior;
use TYPO3\HtmlSanitizer\Builder\Preset\IframePreset;

$behavior = (new Behavior())
    ->withFlags(Behavior::ENCODE_INVALID_TAG | Behavior::REMOVE_UNEXPECTED_CHILDREN)
    ->withName('scenario-test')
    ->withPreset(new IframePreset());
```

Related: TYPO3#91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant