Jump to content

Use each page field values just one time in the admin


icietla
 Share

Recommended Posts

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

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 by icietla
  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...