Skip to content

Commit

Permalink
Using API input array instead of PHP native to grab template ID from …
Browse files Browse the repository at this point in the history
…request
  • Loading branch information
Stikki committed May 29, 2015
1 parent 8c49b8e commit 1b4067a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Pages2JSON.module
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,14 @@ class Pages2JSON extends WireData implements Module, ConfigurableModule

protected function JSONTabActions($event)
{
$id = -1;
if(isset($_POST['id'])) {
$id = (int)$_POST['id'];
} else {
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
}
// Grab current tempalte id
$id = $this->input->id ? $this->input->id : -1;

// Load template or fatal
$template = $this->templates->get($id);
if(!$template) throw new WireException("Unknown template");

// Set data
$var = $this->input->post('json_fields');
$template->set('jsonFields', $var);
}
Expand Down

0 comments on commit 1b4067a

Please sign in to comment.