Matthew,
I have to retract my previous mail, stating the issue is resolved. I've
double checked and there's definitely something strange going on with adding
filters to elements using Zend_Config_Xml. Not sure what it is (probably me
again), so i need help.
I played around with setting different (very wrong) options for the
StripTags filter, so now I have the following in my config file:
<filters>
<striptags>
<filter>StripTags</filter>
<options>
<commentsAllowed>
<tag><![CDATA[<p>]]></tag>
</commentsAllowed>
<attibutesAllowed>
<attrib>class</attrib>
</attibutesAllowed>
</options>
</striptags>
</filters>
I used $form->getElement('body')->getFilter('StripTags') to get the filter
from the element and used a simple print_r to check how it was setup:
Zend_Filter_StripTags Object([commentsAllowed] => [_tagsAllowed:protected]
=> Array([<p> => Array())
[_attributesAllowed:protected] => Array([class] => ))
???
When I use the following config of options:
<filters>
<striptags>
<filter>StripTags</filter>
<options>
<tagsAllowed>
<tag><![CDATA[<p>]]></tag>
</tagsAllowed>
<commentsAllowed>
<![CDATA[<p>]]>
</commentsAllowed>
<attibutesAllowed>
<attrib>class</attrib>
</attibutesAllowed>
</options>
</striptags>
</filters>
I get:
Zend_Filter_StripTags Object([commentsAllowed] => 1 [_tagsAllowed:protected]
=> Array([tag] => Array([<p>] => ))
[_attributesAllowed:protected] => Array([<p>] => ))
What the !@&$????
Questions:
Do I need to add all options in the config file for a filter? Is there a
particular order in which to add those options?
No matter which order I use for setting the options....they simple don't get
set properly! Does it have anything to do with the following code in
Zend_Form_Element::_loadFilter?
if (empty($filter['options'])) {
$instance = new $name;
} else {
$r = new ReflectionClass($name);
if ($r->hasMethod('__construct')) {
$instance = $r->newInstanceArgs((array) $filter['options']);
} else {
$instance = $r->newInstance();
}
}
Regards, TJ.
--
View this message in context:
http://www.nabble.com/in-latest-standard-trunk%3A-decorators-seem-to-have-escaped-from-their-original-logic.-tp18441904p18513972.html
Sent from the Zend Framework mailing list archive at Nabble.com.