Jump to content

Jquerywiretabs call


pogidude
 Share

Recommended Posts

In ProcessPageEdit::init() method, there is this line of code at the bottom which loads JqueryWireTabs module:

if(!$this->isPost) $this->modules->get('JqueryWireTabs');

my question is, what does $this->isPost mean? when is this value true? or false?

Link to comment
Share on other sites

// determine if we're going to be dealing with a save/post request
$this->isPost = ($this->input->post->id > 0 && (((int) $this->input->post->id) === $this->page->id)) || $this->config->ajax && (count($_POST) || isset($_SERVER['HTTP_X_FIELDNAME'])); 

True when there's a request to save the page.

Link to comment
Share on other sites

thanks for the answer wanze. though I still don't get why you need this check in ProcessPageEdit::init(). I mean, what if you're just loading a page for editing? you know, not yet clicked on the "save" buttons.

You're welcome!

If you just load the page for editing, then isPost is false. This means that the JqueryWireTabs get loaded.

I belive the reason behind the check is that if we're dealing with a save-request, there's no need to load UI stuff like JquerWireTabs, because Pw does a redirect after the save.

$this->isPost is used multiple times in the module, so it makes sense to save this long boolean expression in a variable which is easier to read.

  • Like 2
Link to comment
Share on other sites

I belive the reason behind the check is that if we're dealing with a save-request, there's no need to load UI stuff like JquerWireTabs, because Pw does a redirect after the save.

That's correct, it's just an optimization to prevent loading resources that won't be applicable for the request. When ProcessPageEdit performs a save, it doesn't generate any output–it finishes by redirecting back to itself, so there's no need to load things like tabs. 

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