Created
May 4, 2011 20:56
-
-
Save rtripault/956018 to your computer and use it in GitHub Desktop.
FormIt hook for Doodles extra (MODX Revolution)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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