Bug with attributes with default values when they are not declared in the content
sinasquax - June 8, 2009 - 08:49
| Project: | WYSIWYG Filter |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
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 :
<?php
$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 :
<?php
$attribute_options = (isset($allowed_attributes[$attrname]) ? $allowed_attributes[$attrname] : array());
?>then replace on line 670 :
<?php
return FALSE;
}
?>by :
<?php
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

#1
Could you please provide a patch?
http://drupal.org/patch/create
#2
Yes, i have attached it.
Thank you
#3
Committed 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.
#4
Thank you
#5
Automatically closed -- issue fixed for 2 weeks with no activity.