public function workflowAfterSave($data)
{
$id = $this->getState($this->getName() . '.id');
$isNew = $this->getState($this->getName() . '.new');
if ($isNew) {
$path = JPATH_BASE . '/components/' . $this->extension;
$path = Path::check($path);
Form::addFormPath($path . '/forms');
Form::addFormPath($path . '/models/forms');
Form::addFieldPath($path . '/models/fields');
Form::addFormPath($path . '/model/form');
Form::addFieldPath($path . '/model/field');
$form = $this->getForm();
$stage_id = $this->getStageForNewItem($form, $data);
$this->workflow->createAssociation($id, $stage_id);
}
if (!$this->workflowEnabled) {
return;
}
if (!empty($data['transition'])) {
$this->executeTransition([$id], $data['transition']);
}
}