Skip to content

Instantly share code, notes, and snippets.

@pepebe
Created July 23, 2013 10:32
Show Gist options
  • Save pepebe/6061442 to your computer and use it in GitHub Desktop.
Save pepebe/6061442 to your computer and use it in GitHub Desktop.
Write formit values into a debug chunk
<?php
/*
* Write formit values into a debug chunk
* basic idea by bruno17
* Be careful with the append parameter. If your script continues to
* write into the debug chunk, You'll get a GIGANTIC file that
* can cause a wsod (white screen of death) without any hint to the real cause...
*/
$append = false;
$values = $hook->getValues();
$debug['values'] = $values;
$output .= print_r($debug,1);
if ($chunk = $modx->getObject('modChunk',array('name'=>'debug'))){
if($append === true){
$chunk->setContent($chunk->getContent().$output);
}
else {
$chunk->setContent($output);
}
$chunk->save();
}
return true;
@beau-gosse
Copy link

@zaigham,

Assuming the chunk named debug exists, I think you should just call the debug hook as usual:

[[!FormIt? &hooks=`debug2chunk`]]

This hook should write values into that chunk once the form is processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment