- public function initializeWorkflow(WorkflowInterface $workflow) {
- $workflow
- ->addState('draft', $this->t('Draft'))
- ->setStateWeight('draft', -5)
- ->addState('published', $this->t('Published'))
- ->setStateWeight('published', 0)
- ->addTransition('create_new_draft', $this->t('Create New Draft'), ['draft', 'published'], 'draft')
- ->addTransition('publish', $this->t('Publish'), ['draft', 'published'], 'published');
- return $workflow;
- }
-
- /**
- * {@inheritdoc}
- */
- public function checkWorkflowAccess(WorkflowInterface $entity, $operation, AccountInterface $account) {
- if ($operation === 'view') {
- return AccessResult::allowedIfHasPermission($account, 'view content moderation');
- }
- return parent::checkWorkflowAccess($entity, $operation, $account);
- }
-
- /**
- * {@inheritdoc}
- */
- public function decorateState(StateInterface $state) {
- if (isset($this->configuration['states'][$state->id()])) {
+ public function getState($state_id) {
+ $state = parent::getState($state_id);
+ if (isset($this->configuration['states'][$state->id()]['published']) && isset($this->configuration['states'][$state->id()]['default_revision'])) {