Skip to content

[6.x] Add array-style config support for sanitizers#18808

Open
riasvdv wants to merge 1 commit into6.xfrom
rias/pt-3109-add-array-style-config-support-for-sanitizers
Open

[6.x] Add array-style config support for sanitizers#18808
riasvdv wants to merge 1 commit into6.xfrom
rias/pt-3109-add-array-style-config-support-for-sanitizers

Conversation

@riasvdv
Copy link
Copy Markdown
Contributor

@riasvdv riasvdv commented May 7, 2026

Array Config Files

Named sanitizers can also be registered with Symfony-style array config files in config/craft/sanitizers/. The file name becomes the sanitizer name.

<?php

// config/craft/sanitizers/no-headings.php
return [
    'allow_safe_elements' => true,
    'block_elements' => ['h1'],
];

Use it like any other named sanitizer:

{{ body|sanitize('no-headings') }}

@semanticdiff-com
Copy link
Copy Markdown

Review changes with  SemanticDiff

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 7, 2026

@riasvdv riasvdv force-pushed the rias/pt-3109-add-array-style-config-support-for-sanitizers branch from 87992f7 to 974a144 Compare May 7, 2026 12:44
@riasvdv riasvdv force-pushed the rias/pt-3109-add-array-style-config-support-for-sanitizers branch from 974a144 to de81560 Compare May 7, 2026 12:55
@riasvdv riasvdv requested a review from brandonkelly May 7, 2026 13:04
@riasvdv riasvdv marked this pull request as ready for review May 7, 2026 13:04
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