-
Posts
34 -
Joined
-
Last visited
Community Answers
-
Sebii's post in Selectable Pages -> Custom PHP Code: return value NULL not working was marked as the answer
Hi, I think your question has already been answered in a different topic here: https://processwire.com/talk/topic/11955-page-field-based-on-parent/
As suggested there, you might even want to use the AJAX way by using the custom selector (instead of custom PHP).
In your case that should be something like:
parent=page.project_research_field_selector I hope this helps.
-
Sebii's post in Options field and check was marked as the answer
Hi,
if I'm not mistaking, you can check if a specific option is selected using the has() method.
So in your case one of these options should work:
if ($page->portfolio_type->has(1)) { ... } //assuming the option is defined as: "1=A Project" if ($page->portfolio_type->has("title='A Project'")) { ... } Hope this helps.
Edit: Background should be that the option field returns a WireArray. Which has the has() method for checking its content.