Getting Composer Drafts in PageList

Permalink
Hi,

I am trying to list all of the Draft pages in a more friendly interface for a client. I have all of the published pages and their version history, however finding it impossible to get Draft pages which have never been published.

I have a page list, and also used these three calls to get pretty much every page possible:
$list = new \Concrete\Core\Page\PageList();
        $list->ignorePermissions();
        $list->includeInactivePages();
        $list->includeSystemPages();
        $list->includeInactive = true;


includeSystemPages seems to work fine, but includeInactivePages does not include any inactive pages (deleted pages or draft pages). You can see I have tried multiple ways to set this but none work.

Does anyone have any ideas?

Thanks

pixelhero
View Replies: View Best Answer
ramonleenders replied on at Permalink Best Answer Reply
ramonleenders
What happens when you add this:

$list->displayUnapprovedPages();


Because a draft is not approved yet, so it may make sense that it's not being displayed now.
pixelhero replied on at Permalink Reply
pixelhero
All that did was change the status of my pages which were pending approval to be the latest version.

I have 2 blog posts which have changes, but not approved. These show the 'Active' version being version 1 of 2, and version 2 of 2 is the 'Recent' one. By adding that line, those posts both came back as being version 2 of 2, as if it just counted the unapproved pages as being the Active one. This just results in my pending approval pages being shown as published, it is not adding in unpublished Drafts :(

Thanks though
ramonleenders replied on at Permalink Reply
ramonleenders
OK. Well since you're willing to show the versions and such, I'm guessing you're willing to do something like this, right?

http://www.concrete5.org/marketplace/addons/pending-pages...

Not sure if you're looking for dollars to spend or not, but it will save you a couple of programming/styling hours I guess haha. If not, you probably end up writing some manual queries instead. If I'm not mistaken, it took me some figuring out to do all this too as not everything is available in the page list class by default.
pixelhero replied on at Permalink Reply
pixelhero
Ah, I managed to get it working. I had commented out system pages, so this does get them:

$list->includeInactivePages();
        $list->includeSystemPages();
        $list->displayUnapprovedPages();
        $list->filterByCollectionTypeHandle('article');


However the versions come back wrong, so I will have to do an extra version check afterwards, but thats better than where I was before.

Thanks :)
ramonleenders replied on at Permalink Reply
ramonleenders
Hah, glad I got you somewhere! :D