/** * Content can never be directly publishable if there's a workflow applied. * * If there's an active instance, then it 'might' be publishable */ public function canPublish() { if ($active = $this->getWorkflowInstance()) { return $active->canPublishTarget($this->owner); } // otherwise, see if there's any workflows applied. If there are, then we shouldn't be able // to directly publish if ($effective = $this->workflowService->getDefinitionFor($this->owner)) { return false; } }
/** * Content can never be directly publishable if there's a workflow applied. * * If there's an active instance, then it 'might' be publishable */ public function canPublish() { // Override any default behaviour, to allow queuedjobs to complete if ($this->isPublishJobRunning()) { return true; } if ($active = $this->getWorkflowInstance()) { return $active->canPublishTarget($this->owner); } // otherwise, see if there's any workflows applied. If there are, then we shouldn't be able // to directly publish if ($effective = $this->workflowService->getDefinitionFor($this->owner)) { return false; } }
public function setIsWorkflowInEffect() { // if there is a workflow applied, we can't set the publishing date directly, only the 'desired' publishing date $effective = $this->workflowService->getDefinitionFor($this->owner); $this->isWorkflowInEffect = $effective ? true : false; }