com_connect
com_connect copied to clipboard
parse $thing in zem_contact_option
Another little thingy, I've seen while testing: $thing (and/or label) in zem_contact_option should be parsed by parse().
Does it not get parsed here? I thought parse was recursive? Maybe it isn't...
Do you have an example of a select/option form that breaks because it needs parsing? I can then use it to test the functionality and fix it if necessary.
Hm, weird thing. Here is my example:
<txp:zem_contact_select break="" label="Category">
<option value="">Choose…</option>
<txp:category_list parent="a_category">
<txp:zem_contact_option value='<txp:category />'><txp:category title="1" /></txp:zem_contact_option>
</txp:category_list>
</txp:zem_contact_select>
As in the code you mentioned it should be parsed. But only the wrapped zem_contact_option is parsed to
<option class="zemOption" value="category_name"><txp:category title="1" /></option>
The inner $thing is only handled by txpspecialchars() from the zem_contact_option tag. I've to explicitly parse the $thing in Line 1172 and L1173.
Btw. How do you link to an line number here in GitHub markdown without linking to an issue (#L)?
I think, that's the problem. The txpspecialchars() in zem_contact_option is called first and all resulting $thing/$label - as <txp:category title="1" /> in my example - will be txpspecialchars()'d in the first. So there is only a <txp:category title="1" /> to be parsed.
So is the solution to parse($thing) in zem_contact_option somewhere near the top of the function, before $atts is extracted so that the $match gets set correctly? e.g.:
function zem_contact_option($atts, $thing = null)
{
static $options;
static $match;
if ($thing !== null) {
$thing = parse($thing);
}
if ($atts === null) {
...
Or will that introduce other oddness?
Not tested yet, but this will only parse $thing and not $label or $value, isn't it?
The resulting html option inner text (option label) can be all other $atts parameters as $label and $value and $thing (see Line1173).