thrownew\InvalidArgumentException(sprintf('The "%s" HTML tag has an attribute restriction "%s" which contains whitespace. Omit the whitespace.',$html_tag_name,$html_tag_attribute_name));
}
if($html_tag_attribute_name==='*'){
thrownew\InvalidArgumentException(sprintf('The "%s" HTML tag has an attribute restriction "*". This implies all attributes are allowed. Remove the attribute restriction instead, or use a prefix (`*-foo`), infix (`*-foo-*`) or suffix (`foo-*`) wildcard restriction instead.',$html_tag_name));
}
}
}
}
@@ -413,6 +416,40 @@ function ($value, string $tag) use ($other) {
ARRAY_FILTER_USE_BOTH
);
// Special case: wildcard attributes, and the ability to define restrictions
// for all concrete attributes matching them using:
// - prefix wildcard, f.e. `data-*`, to match `data-foo`, `data-bar`, etc.
// - infix wildcard, f.e. `*-entity-*`
// - suffix wildcard, f.e. `foo-*`
foreach($diff_elementsas$tag=>$tag_config){
// If there are no per-attribute restrictions for this tag in either
// operand, then no wildcard attribute postprocessing is needed.
'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-*>.',
]),
];
yield"restricted_html can be switched to CKEditor 5 after dropping the two markup-creating filters (3 upgrade messages)"=>[
@@ -73,6 +73,10 @@ public function providerConstruct(): \Generator {
['foo'=>['baz'=>''],'bar'=>[' qux'=>'']],
'The "bar" HTML tag has an attribute restriction " qux" which contains whitespace. Omit the whitespace.',
];
yield'INVALID: keys valid, values invalid attribute restrictions due to broad wildcard instead of prefix/infix/suffix wildcard attribute name'=>[
['foo'=>['*'=>TRUE]],
'The "foo" HTML tag has an attribute restriction "*". This implies all attributes are allowed. Remove the attribute restriction instead, or use a prefix (`*-foo`), infix (`*-foo-*`) or suffix (`foo-*`) wildcard restriction instead.',
];
// Invalid HTML tag attribute value restrictions.
yield'INVALID: keys valid, values invalid attribute restrictions due to empty strings'=>[
@@ -238,10 +242,6 @@ public function providerConvenienceConstructors(): \Generator {
'<a target class>',
['a'=>['target'=>TRUE,'class'=>TRUE]],
];
yield'tag with two attributes, one with a partial wildcard'=>[
'<a target class>',
['a'=>['target'=>TRUE,'class'=>TRUE]],
];
// Multiple tag cases.
yield'two tags'=>[
@@ -253,7 +253,7 @@ public function providerConvenienceConstructors(): \Generator {