Jump to content

Recommended Posts

Posted

Hi,

I want to get a page which is one of the current page's siblings. It's hidden and the following problem occurs:

Case 1: Works if specified page is not hidden, but it has to be hidden, so not an option.

$page->siblings->get("name=some-name");

Case 2: Returns a null page

$page->siblings->get("name=some-name, include=hidden");

Case 3: Works

$page->siblings("name=some-name, include=hidden")->first();

Case 2 should work, but it doesn't.

Bug or feature?

Posted

Not completely sure, but I think get($selector) only works with $pages and not with other array objects, as opposed to get($key).

You have one more option though:

$pages->get("parent={$page->parent}, name=some-name, include=hidden");
Posted

The strange thing is, that PageArray::get() is internally just syntactic sugar for $pa->find()->first(). So does this work?

$page->siblings->find("name=some-name, include=hidden")->first();

Maybe the returned PageArray of siblings is already excluding your hidden page.

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.
×
×
  • Create New...