This question has been answered by Bruno17. See the first response.
public function afterSave() {
$id = $this->object->get('id');
// do something with the id
return true;
}Is there a way of saving a new value from the afterSave() function?
public function afterSave() {
$id = $this->object->get('id');
// do something with the id
$this->object->set('fullpath',$this->object->get('path') . $id . '/' );
$this->object->save();
return true;
}
$response = $modx->runProcessor('element/chunk/create',array(
'name' => 'NewChunk',
'description' => 'A test Chunk made with runProcessor.',
'snippet' => '<h3>Chunkify!</h3>',
));
if ($response->isError()) {
return $response->getMessage();
}
$chunkArray = $response->getObject();
return 'The chunk "'.$chunkArray['name'].' was created with ID '.$chunkArray['id'];
$modx->runProcessor('mgr/example/myProcessor',array(...));
$options = array( 'processors_path' => 'path/to/your/processors/dir/', )