Jump to content

Complex PHP Selector for pagefield


Recommended Posts

I have a template called "activity" with two pagetable fields.





uses "cast" template for creating castpages.

the cast template contains a pagefield called select_multi_dates.


uses "date" template for creating datepages.

the date template contains a pagefield called select_activity.

Now what i want is create a cast with activity_create_cast and I want that the selection of the select_multi_dates pagefield should be the pages wich i created before with the activity_create_date.

How can I achieve this under the select_multi_dates pagefield with a PHP-Selector?

I know its complicated PHP-Selector. Hope you can help me.

Thanks for your attention.


Link to comment
Share on other sites

All Castpages are created under the activity:

It looks like this:


And the select_multi_dates field is on the cast template. So I thought i could get the current Activity with the casts parent and then access the items/pages from the activity_create_date pagetable.

$currentActivity = $page->parent;

return $currentActivity->activity_create_date;

Unfortunately it doesnt work, I get this error:

Fatal error: Call to a member function has() on a non-object in /Users/praktikant/Sites/Kulturdatenbank.pw.2.0/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module on line 253
Link to comment
Share on other sites

The method InputfieldPage::getSelectablePages needs to know the page you are editing. This seems to be wrong and it is probably Fredi's fault since you are getting "his" ID. Try disabling Fredi and see if it works. 

Otherwise you can try to Hook before InputfieldPage::getSelectablePages and make sure it sees the right page

$event->arguments(0, $page_you_want);

I hope this helps. 

Link to comment
Share on other sites

Thank you for your input Thomas. But it does not matter more because I have changed the concept. I'm working now with Custom Admin Pages in the Backend, creating Dashboards, Listers with ListerPro for the different Pages: Event, Dates, Images, Videos etc.... The Goal is to achieve a Culturedatabase with the Processwire-Backend where you can create/edit events, dates or also import/export the data for individual use in other websites/services. Before I have done this with a Frontend for the Backendsystem where you can create/read/update/delete events, dates with the Fredi-Module from apeisa. But still thank you for your commitment.

PS: Processwire is great :lol:

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

  • Create New...