Jump to content

Page reference populated with pages from another PW backend


Recommended Posts

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

$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;



  • Like 4
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...