Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello, when an attribute has a default value in the filter rules but this attribute is not declared in the content source, so the attribute is not added to the output (normally this must be added with the default value).
I have made a little patch to correct this, in wysiwyg_filter.module on line 679, replace :
$attribute_options = (isset($allowed_attributes[$attrname]) ? $allowed_attributes[$attrname] : array());
// When no attribute value has been specified in parsed HTML stream,
// then supply default value if provided by input format settings.
if (!isset($attrinfo['value']) && isset($attribute_options['default'])) {
$attrinfo['value'] = $attribute_options['default'];
}
by :
$attribute_options = (isset($allowed_attributes[$attrname]) ? $allowed_attributes[$attrname] : array());
then replace on line 670 :
return FALSE;
}
by :
return FALSE;
}
// When no attribute value has been specified in parsed HTML stream,
// then supply default value if provided by input format settings.
if (!isset($attrinfo['value']) && isset($allowed_attributes[$attrname]['default'])) {
$attrarr[$attrname] = array('value' => $allowed_attributes[$attrname]['default'], 'delimiter' => '"');
}
Now, attributes with default value will be added to the output even if they are not declared in the content source
Comment | File | Size | Author |
---|---|---|---|
#2 | wysiwyg_filter-D6.patch | 1.31 KB | sinasquax |
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedCould you please provide a patch?
http://drupal.org/patch/create
Comment #2
sinasquax CreditAttribution: sinasquax commentedYes, i have attached it.
Thank you
Comment #3
markus_petrux CreditAttribution: markus_petrux commentedCommitted to CVS. Thank you!
This does not seem to be a critical issue, so I'll wait for a few days before creating a new release, just in case anything else arises.
Comment #4
sinasquax CreditAttribution: sinasquax commentedThank you