Skip to content
Snippets Groups Projects
Commit c7a69429 authored by catch's avatar catch
Browse files

Issue #3272516 by Wim Leers, yogeshmpawar, bnjmnm, catch: Deprecate...

Issue #3272516 by Wim Leers, yogeshmpawar, bnjmnm, catch: Deprecate FilterInterface::getHTMLRestrictions()' forbidden_tags functionality
parent 27389d1d
Branches
Tags
23 merge requests!8357Issue #2994000 by Lendude, Pasqualle, quietone, pameeela: Notice in logs when...,!4488Issue #3376281: Random machine names no longer need to be wrapped in strtolower(),!3149Issue #3282285: Email "" does not comply with addr-spec of RFC 2822,!3000Issue #793660: Check for failure of hook_install,!2940Issue #3320240: Entity count query returns a string instead of int,!2937Issue #3315245: Order of languages overrides default language fallback,!2877Issue #3056652 by yogeshmpawar, mashermike, aalin, ranjith_kumar_k_u: Link...,!2804URL of image field formatter use absolute URL option.,!2749Issue #3309024: Focus on the wrong submit button after AJAX submit,!2692Issue #3284010 by _shY, mherchel, Abhijith S: "Create content" link within...,!2608Issue #2430379 by quietone, znerol, larowlan: Add explicit test for session...,!2575Issue #3198340 by alexpott, xjm, cilefen, Mile23, mmjvb, catch, longwave, mfb,...,!2555Issue #3277148 by rpayanm, andregp, joachim, Farnoosh, Athrylith, Jingting:...,!2554Issue #3277148 by rpayanm, andregp, joachim, Farnoosh, Athrylith, Jingting:...,!2539Issue #3299806 by BenStallings: Include uuid field in d7_node migration, if present.,!2453Issue #332796 by voleger, dww, Steve Dondley, ykhadilkar, Dave Reid,...,!2426Issue #3278314 by acbramley: InlineBlockUsageInterface::getUsage can return...,!2268Issue #3085219: Redesign Installer,!1627Issue #3082958: Add gitignore(s) to composer-ready project templates,!1014Issue #3226806: Move filter implementations from filter.module to plugin classes,!939Issue #2971209: Allow the MediaLibraryUiBuilder service to use an alternative view display,!828#3082672 Form prefix/suffix redesign in Claro,!88Issue #3163299: Ajax exposed filters not working for multiple instances of the same Views block placed on one page
......@@ -43,7 +43,6 @@ class ValidatorsTest extends KernelTestBase {
'ckeditor5_plugin_conditions_test',
'editor',
'filter',
'filter_test',
'media',
'media_library',
'views',
......@@ -462,33 +461,6 @@ public function providerPair(): array {
],
'violations' => [],
];
$data['INVALID: forbidden tags'] = [
'settings' => [
'toolbar' => [
'items' => [],
],
'plugins' => [],
],
'image_upload' => [
'status' => FALSE,
],
'filters' => [
'filter_test_restrict_tags_and_attributes' => [
'id' => 'filter_test_restrict_tags_and_attributes',
'provider' => 'filter_test',
'status' => TRUE,
'weight' => 0,
'settings' => [
'restrictions' => [
'forbidden_tags' => ['p' => FALSE],
],
],
],
],
'violations' => [
'' => 'CKEditor 5 needs at least the &lt;p&gt; and &lt;br&gt; tags to be allowed to be able to function. They are forbidden by the "<em class="placeholder">Tag and attribute restricting filter</em>" (<em class="placeholder">filter_test_restrict_tags_and_attributes</em>) filter.',
],
];
$restricted_html_format_filters = Yaml::parseFile(__DIR__ . '/../../../../../profiles/standard/config/install/filter.format.restricted_html.yml')['filters'];
$data['INVALID: the default restricted_html text format'] = [
'settings' => [
......
......@@ -297,6 +297,10 @@ public function getHtmlRestrictions() {
$restrictions = array_reduce($filters, function ($restrictions, $filter) {
$new_restrictions = $filter->getHTMLRestrictions();
if (isset($new_restrictions['forbidden_tags'])) {
@trigger_error('forbidden_tags for FilterInterface::getHTMLRestrictions() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0', E_USER_DEPRECATED);
}
// The first filter with HTML restrictions provides the initial set.
if (!isset($restrictions)) {
return $new_restrictions;
......
......@@ -198,7 +198,7 @@ public function process($text, $langcode);
* be attribute values (which may use a wildcard, e.g. "xsd:*"),
* the possible values are TRUE or FALSE: to mark the attribute
* value as allowed or forbidden, respectively
* - 'forbidden_tags': (optional) the forbidden tags
* - 'forbidden_tags': (deprecated) the forbidden tags
*
* There is one special case: the "wildcard tag", "*": any attribute
* restrictions on that pseudotag apply to all tags.
......
......@@ -509,4 +509,28 @@ public function testSleep() {
$this->assertNotContains('filterCollection', $vars);
}
/**
* Tests deprecated "forbidden tags" functionality.
*
* @group legacy
*/
public function testForbiddenTagsDeprecated(): void {
$this->expectDeprecation('forbidden_tags for FilterInterface::getHTMLRestrictions() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0');
FilterFormat::create([
'format' => 'forbidden_tags_deprecation_test',
'name' => 'Forbidden tags deprecation test',
'filters' => [
'filter_test_restrict_tags_and_attributes' => [
'status' => TRUE,
'settings' => [
'restrictions' => [
'forbidden_tags' => ['p' => FALSE],
],
],
],
],
])->save();
FilterFormat::load('forbidden_tags_deprecation_test')->getHtmlRestrictions();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment