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

[FEATURE] Add possibility to declare and apply presets to behavior #93

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ohader
Copy link
Member

@ohader ohader commented Oct 20, 2022

Example (uses preset declaring <iframe> and applies it):

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: #91

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
Copy link
Member Author

ohader commented Nov 26, 2022

Separate PresetInterface from specific implementations. Besides IFramePreset the might be a ScriptJsonLdPreset (#71).

@ohader ohader marked this pull request as draft November 26, 2022 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant