charger Posted August 5, 2021 Share Posted August 5, 2021 I have the following need: In backend A I want to have a page reference field that lists pages of a certain template in backend B. I don’t need the whole page data copied from B to A, just a reference to access it afterwards. Did anyone solve a similar problem before? Link to comment Share on other sites More sharing options...
Zeka Posted August 6, 2021 Share Posted August 6, 2021 $wire->addHookAfter('InputfieldPage::getSelectablePages', function (HookEvent $event) { if ($event->object->hasField->name === 'category') { // Server path to the PW installation $path = '/home/modules/www/'; // The root URL for the PW installation $url = 'http://modules.processwire.com/'; // Create a new ProcessWire instance $site = new ProcessWire($path, $url); // Find some pages $items = $site->pages->find("template=categories, limit=5, sort=-created"); $event->return = $items; } }); https://processwire.com/api/ref/inputfield-page/get-selectable-pages/ https://processwire.com/blog/posts/multi-instance-pw3/ 4 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