Data source parameter output: commas not escaped
This is a closed discussion with 7 replies, filed under Troubleshooting.
Search
I believe Field::getParameterPoolValue()
is called on the field. If the field does not specify this itself, the definition in class.field returns Field::prepareTableValue
.
The value gets written to the param pool in datasource.section.php
by the looks of things:
if(isset($this->dsParamPARAMOUTPUT) && $this->dsParamPARAMOUTPUT == $fieldPool[$field_id]->get('element_name')){ $param_pool[$key][] = $fieldPool[$field_id]->getParameterPoolValue($values); }
Looks like these might be converted into strings in class.frontendpage.php
:
if(is_array($this->_env['pool']) && !empty($this->_env['pool'])){ foreach($this->_env['pool'] as $handle => $p){ if(!is_array($p)) $p = array($p); foreach($p as $key => $value){ if(is_array($value) && !empty($value)){ foreach($value as $kk => $vv){ $this->_param[$handle] .= @implode(', ', $vv) . ','; } } else{ $this->_param[$handle] = @implode(', ', $p); } } $this->_param[$handle] = trim($this->_param[$handle], ','); } }
Okay, this is how the pool is populated. But how would it be possible to escape the commas in the field values so that they won’t be recognized when the string is separated into its parts again (using explode
or preg_replace
)?
Maybe one for Alistair ;-)
Hopefully :)
git push master:alistair --bug
Wish this thread had shown up a bit earlier. Alistair just did some work on that bit of code last night.
I’ll take a look at it today.
Posted on the issue tracker. http://github.com/symphony/symphony-2/issues/#issue/120 I’d rather keep it there, so going to close this thread.
Create an account or sign in to comment.
Please excuse the double post here and in the bug tracker, but maybe someone in the forum has a solution for this problem:
I have a data source that returns course names as parameter output. It’s working just fine, expect for those course names containing a comma, because commas are used as parameter delimiter:
The parameter `$ds-teilnehmen-kurse represents three courses:
But apparently it’s interpreted as four separate items:
Does anybody know where in the code these commas should be escaped and how this could be done without breaking other parts of the system?
Thanks for your help!
Nils