Jump to content
Orkun

Complex PHP Selector for pagefield

Recommended Posts

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

Fields:

activity_create_cast

activity_create_date

activity_create_cast:

uses "cast" template for creating castpages.

the cast template contains a pagefield called select_multi_dates.

activity_create_date:

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.

Nukro

Share this post


Link to post
Share on other sites

All Castpages are created under the activity:

It looks like this:

post-3125-0-38555900-1444827442_thumb.pn

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

Share this post


Link to post
Share on other sites

I tried to echo $page on the select_multi_dates field. I get this:

post-3125-0-96305800-1444828590_thumb.pn

$page dont return the cast page, it returns the "Fredi - edit page process" page.

How can I solve this?

Share this post


Link to post
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. 

Share this post


Link to post
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:

Share this post


Link to post
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.

  • Similar Content

    • By Spyros
      Hello
      I'm having a strange issue with the $page->find(), for some reason I'm missing some of the pages from the results. I found then that I was missing all the pages with the same "PAGE NAME". Is it a bug or am I missing something?
      PS 
      If I change the "PAGE NAME" of one of the missing ones then I'm retrieving the page without any problem.
      Thank you
    • By benbyf
      Hi, Looking to create form elements on a page–some input with a colection of form inputs and the appropriate labels and variables for that input. I've used ProForms in the past and rolled out my own when creating simply one off forms, but I wonder if anyone has found a good way of allowing form creation on page editing so that clients can adhocly make and edit forms?
      Thanks
    • By EyeDentify
      Hello Dear PW Gurus.

      Hope you fair well in these Corona Crisis times.

      Anyhow, i have a problem with a Cryptic error message that shows up when i am trying to Delete images out of a Images field.
      The Error message does say a little but it does not make sense to me why i can´t delete the images because of it.

      Is it some permission issue perhaps?

      I will attach screenshots of it and what i did prior to it.
      I am from sweden so ignore the funny words here and there.

      Hope you all can send me on the right track.
      i am running PW 3.0.139 on this install.

      Step1:

      Step 2: Select the images with the trashcan symbol

       
      Step 3: Cryptic Error message

      I am scratching my head on this one, have not seen this before.

      Thankfull for all help.
      /EyeDentify
    • By Marvin
      Hello, i want to ask, i maintain a website that using a processwire and php, and i want to make an archive at my website using a subfolder system, but when i try,
      the sebfolder is show but when i click the files in that subfolder not show, and my browser just show me an error Invalid argument supplied for foreach(), i don't know why it error
      Here i attach my code and my screenshoot website :
      This is my code

      This is result of my website

      This is my error

       
       
    • By Mithlesh
      Hi there,
      My form is not getting submitted, it is showing:
      Unable to verify successful email delivery of this form submission.
      Attaching for your reference as well: 

      In the Backend, it is showing Connection timed out with smtp.gmail.com
      Pl guide me how to resolve that
×
×
  • Create New...