private function _renderEntrySidebarPanel($template)
{
$settings = $this->getSettings();
craft()->templates->hook('cp.entries.edit.right-pane', function (&$context) use($settings, $template) {
if (!$context['entry']->id) {
return;
}
// Make sure workflow is enabled for this section - or all section
if ($settings->enabledSections != '*') {
if (!in_array($context['entry']->sectionId, $settings->enabledSections)) {
return;
}
}
// See if there's an existing submission
$draftId = isset($context['draftId']) ? $context['draftId'] : ':empty:';
$submissions = craft()->workflow_submissions->getAllByOwnerId($context['entry']->id, $draftId);
return craft()->templates->render('workflow/_includes/' . $template, array('context' => $context, 'submissions' => $submissions));
});
}