Skip to content

Instantly share code, notes, and snippets.

@rtripault
Created May 4, 2011 20:56
Show Gist options
  • Save rtripault/956018 to your computer and use it in GitHub Desktop.
Save rtripault/956018 to your computer and use it in GitHub Desktop.
FormIt hook for Doodles extra (MODX Revolution)
<?php
$doodle = $modx->getService('doodles','Doodles',$modx->getOption('doodles.core_path',null,$modx->getOption('core_path').'components/doodles/').'model/doodles/');
if (!($doodle instanceof Doodles)) {
$hook->addError('error_message','Unable to load doodle service.');
return false;
};
$newEntry = $modx->newObject('Doodle');
$newEntry->fromArray($scriptProperties['fields']);
/* save */
if ($newEntry->save() == false) {
$hook->addError('error_message','Unable to add new doodle entry to the database.');
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment