Jump to content

PageFieldType help


fmgujju
 Share

Recommended Posts

I have created Page field type and set as Multiple pages (PageArray) option under details and set Input as "template of the pages" (template-X). I am using this PageFieldType on other template (template-Y) to select multiple pages by providing checkbox.

I created some pages with template-X and selected some of those pages on the template-Y page. I can able to display selected pages on the template-Y page on the front-end but I want to display all of the pages created by template-X on the template-Y page with flag that can tell which one was selected and which one don't. I was able to display only selected pages list and all of the template-X pages on template-Y separately.

If its unclear then please let me know. Thanks!

Link to comment
Share on other sites

Something like this?

$allPages = $pages->find('template=template-X');
$selectedPages = $page->pagesWithTemplateX;
foreach ($allPages as $p) {
  $selected = ($selectedPages->has($p)) ? 'selected' : 'not selected';
  echo $p->title . " is {$selected}";
}
  • Like 2
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
 Share

  • Recently Browsing   0 members

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