icietla Posted March 17, 2016 Share Posted March 17, 2016 Hello, I use a page field to link members to cities. But a city must be associated just with 1 member, no more. And of course, in the admin, when I go to the member page, the page field "cities" lists all values even if they are already used. So the question is " In the admin, can we filter values of a page field with a rule (a custom function?) " ? In my case, if the value is already linked to a member. Thanks a lot for your help! Chris Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 17, 2016 Share Posted March 17, 2016 You can use the php selection for the pagefield and remove all cities. which are already linked. 2 Link to comment Share on other sites More sharing options...
icietla Posted March 17, 2016 Author Share Posted March 17, 2016 (edited) Extra! I've used a PHP snippet and it works well! Tranks a lot, I even not know this possibility... great I'm always amazed how PW can be customized to match any project!!! And if it can help someone else, the snippet in my case: // Toutes les villes $all=$pages->find("template=ville"); // Conseillers avec 1 ville principale $conseillers_linked=$pages->find("lien_ville_principale.count>0"); // Suppression des villes liées foreach ($conseillers_linked as $item) $all->remove($item->lien_ville_principale); // return villes non liées return $all; Edited March 17, 2016 by icietla 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now