Skip to content

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

Merged
brandonkelly merged 3 commits into6.xfrom
rias/pt-3109-add-array-style-config-support-for-sanitizers
May 8, 2026
Merged

[6.x] Add array-style config support for sanitizers#18808
brandonkelly merged 3 commits 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') }}

@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
@craftcms craftcms deleted a comment from semanticdiff-com Bot May 8, 2026
@brandonkelly brandonkelly merged commit 41145c6 into 6.x May 8, 2026
@brandonkelly brandonkelly deleted the rias/pt-3109-add-array-style-config-support-for-sanitizers branch May 8, 2026 18:35
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.

2 participants