Jump to content

Changed ProcessPageEdit to ProcessPageView?


Adam Kiss
 Share

Recommended Posts

In my previous module, I checked $this->processPage against 'ProcessPageEdit'. Right now, admin->edit page returns processPage of value 'ProcessPageView'.

Has this been changed recently-ish, or am I confused and I did stumble on different ProcessPage type?

Link to comment
Share on other sites

But then again:

If I'm in module public function, $this->process returns ProcessPageView and $this->page->process return ProcessPageEdit. Which relates to what? (I suspect that the first relates to adminpage you currently 'view', and the second one relates to it's page field, or the page you're trying to edit, hence 'ProcessPageEdit')

Amiright?

Link to comment
Share on other sites

If the page in question actually has a field called 'process', then checking $page->process is going to return the value of that field. But $this->process [or wire('process')] is a runtime property that is made available to the system and represents the process that is currently running. My guess is that you probably don't want to be looking at the $page->process.

Link to comment
Share on other sites

So it's not safe for me to assume that you want $this->process or $this->page->process. It really depends on the context. In the example you linked to, it has to check $this->page->process because it's checking to see what process is going to be executed, not what process is being executed. Since it was a 'before' hook happening before the page render, the value of $this->process was always going to be ProcessPageView (viewing an admin page). But once that page render started, then it would load the new process (ProcessPageEdit or otherwise) and execute it, and then populate $this->process with that one instead. So the value of $this->process will change according to what is being executed and where it is in the execution process. That's why it's checking against $this->page->process rather than $this->process. Let me know if this doesn't make sense, I'm trying to type this out quickly and am not sure if I'm being clear.

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