Jump to content

Overriding $page->rootParent()


teppo
 Share

Recommended Posts

Little bit of background:

I'm trying to use (and hack) Multisite-module by @apeisa for a client project, but got stuck on one somewhat annoying problem: it doesn't do anything to $page->rootParent(), thus that still returns site root or first page after that, which isn't very useful here. Most straightforward way to override this would seem to be hooking into rootParent and altering it's return value or completely replacing it with my own method. I've tested this with local installation and this method seems to work.

So, my question is: would it be possible to make $page->rootParent() hookable or do I have to hack my way around this problem? Not really sure if altering rootParent is a common need, but it sounds justified in cases where you're overwriting PW URL scheme somehow (like Antti's Multisite module does.)

Of course if there's a better way, I'm open for ideas too :)

Link to comment
Share on other sites

@apeisa: thanks, that's actually a good idea and something I could probably work with. I'd still prefer to have rootParent work consistently with or without Multisite in use -- it's a core feature after all and I'm kind of used to it already :)

Link to comment
Share on other sites

@ryan: Thank you!

@apeisa: I've got it implemented in our testing environment already, though it's a bit ugly at the moment so I'll probably find better way to do it. I'll take a look at this asap and send you a pm or something, unless you're in a hurry? :)

.. and you're absolutely right about it being behind a setting, now that I think about it -- don't want to break anything for existing users, 'cause that would be just mean.

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

×
×
  • Create New...