Editor: Select Options: Adding where conditions to server-side script
Editor: Select Options: Adding where conditions to server-side script
I feel like I've been asking a lot of questions on the subject of Select fields and populating their options recently, but hopefully this will be my last one for a while.
I'm populating my Editor select boxes using PHP, but am now looking to filter the option entries for each one using WHERE conditions on other data present in its table row.
As I understand it this can be done by adding a closure function, but I'm still a bit of a novice when it comes to object oriented PHP, and this example doesn't give me much to go on.
From the example...
->options( 'users', 'id', array('first_name', 'last_name') )
..I'm guessing that I need to include my WHERE clauses as a third parameter for my options?
Grateful for any help on this one.
Replies
Disregard this. Only just found the Joins Options section of the Editor manual!