Adam Kiss Posted June 12, 2011 Share Posted June 12, 2011 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 More sharing options...
Adam Kiss Posted June 12, 2011 Author Share Posted June 12, 2011 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 More sharing options...
ryan Posted June 13, 2011 Share Posted June 13, 2011 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 More sharing options...
Adam Kiss Posted June 13, 2011 Author Share Posted June 13, 2011 ...except YOU programmed it that way ($this->page->process), here: http://processwire.com/talk/index.php/topic,255.0.html I don't really care that much if it works I implemented that if/ loading you adviced on the on that thread... But PW was blazing fast before, so I have no data to compare... Only... it still is on fire ;D Link to comment Share on other sites More sharing options...
ryan Posted June 13, 2011 Share Posted June 13, 2011 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 More sharing options...
Adam Kiss Posted June 13, 2011 Author Share Posted June 13, 2011 It does make sense, thanks. I still have to find time to play with PW. There is no time to find out this stuff if you're rushing to get the work done. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now