Jump to content

How to select page with certain process


apeisa
 Share

Recommended Posts

I have some problems to get selectors working.

<?php
// This works:
$this->pages->get("template=admin,name=completed");

// This doesn't work:
$psi = $this->modules->get('SettingItem');
$this->pages->get("template=admin,process=$psi,name=completed");

// Doesn't work:
$this->pages->get("template=admin,process=SettingItem,name=completed");

I have admin page with process called "SettingItem" selected.

Link to comment
Share on other sites

I thought this should work, but not sure why you want to get page by process.

I now there's $page->process to get but why can't you just use name? Do you have multiple pages with the same process? Maybe possible to use a prefix in the name and do a search "name^=prefix" to get all. ?

Link to comment
Share on other sites

I hadn't really considered this particular Fieldtype as one that would be used for searching, so that's something we may need to upgrade in FieldtypeModule. However, I think that this should work right now:

<?php
$id = wire('modules')->getModuleID('SettingItem'); 
$this->pages->get("template=admin, process=$id, name=completed"); 
Link to comment
Share on other sites

I now there's $page->process to get but why can't you just use name? Do you have multiple pages with the same process? Maybe possible to use a prefix in the name and do a search "name^=prefix" to get all. ?

I want to be sure to get the right page. I don't want to make any assumptions that there won't be admin pages with same name or that some of the names on path won't change (although this would be pretty edge case to be honest).

Ryan: Thanks! I think that is well enough, no need to make changes because of this. I'll let you know if it doesn't work.

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...