[SOLVED] Filtering DS by output parameter's value, not handle
This is an open discussion with 8 replies, filed under General.
Search
I'll give you some pointers; don't have the time to do it but should be enough.
you should need to add a getParameterPoolValue function in here
which would override default behaviour. You can look at its implementation in other fields so you can understand what goes on. In your case output the value instead of the handle, should be straight forward.
Thanks 100times gunglien, will see on that. Hope to manage.
OK, I tried to add
public function getParameterPoolValue(array $data, $entry_id=NULL){ return $data['value']; }
but the filtered DS returned the same results as without this change. I tried a return "10";
just to check if I really influence the output parameter and it does.
brendo pointed me to do something with imploding the value, but actually I have no clue where to add it and what exactly. I tried something here and there, but that had no point.
Try this:
public function getParameterPoolValue(array $data, $entry_id=NULL){ return $data['handle']; }
I think, if you return more then one, it has to be an array so my guess is this.
return explode(","$data['value']);
implode takes an array to a string, explode does exactly the reverse.
edit: fixed the param order in the function
MAN, I LOVE YOU! :)
That did it.
PS: To be precise, those parameters I had to switch to return explode(',', $data['value']);
, but this I do too often so I check regulary.
The final for now is something like
public function getParameterPoolValue(array $data, $entry_id=NULL){ if (strpos($data['value'], ',') === false) return $data['value']; else return explode(',', $data['value']); }
My DB queries dropped by half thanks to this. What a relief.
I owe you at least one! Many thanks.
I will share later on as I finish, what I was following with all this. Will be next week. Maybe I had only a big trip with this, but we will see :)
Thanks again.
you're welcome glad you could sort it out :)
Create an account or sign in to comment.
Following this thread, I am sending (in example) a
100, 200, 300
reflection field value as an output parameter to chain filter another DS'ssystem ids
.The problem is it returns only the
100
entry, as it useshandle
rather than the actualvalue
, as I have been told, if I understand right.Could you help me to modify the process so the
value
would get through and would be used? Haven't managed with my attempts so far.Is it about to comment out something in the Reflection field extension, or about - hope not - the core? Or is this a hire-only task?
Thanks.