Jump to content

hook ProcessPageList "showRootPage"


bernhard
 Share

Recommended Posts

hi all,

i managed to hook ProcessPageList::find to return the right set of pages but i don't know to set "showRootPage" to false via hook :(

if i set this line to "false" it works as expected, but i want to set this based on the role of the logged in user and of course i don't want to hack the core:

https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessPageList/ProcessPageList.module#L61

I'm making my first steps how to hook into methods but i don't know how to set properties of the class via hook in general?

thanks for your help! :)

Link to comment
Share on other sites

  • 1 year later...

In ProcessPageList::find you can set showRootPage to false like this (trial and error):

$event->object->set('showRootPage', false);

// or this:
// $event->object->showRootPage = false;

 

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