Skip to content

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

Draft
ohader wants to merge 1 commit intoTYPO3:mainfrom
ohader:feature/91-preset
Draft

[FEATURE] Add possibility to declare and apply presets to behavior#93
ohader wants to merge 1 commit intoTYPO3:mainfrom
ohader:feature/91-preset

Conversation

@ohader
Copy link
Copy Markdown
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
Copy Markdown
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