public function SetFlowStatus::setStatus in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Controller/SetFlowStatus.php \Drupal\cms_content_sync\Controller\SetFlowStatus::setStatus()
- 2.0.x src/Controller/SetFlowStatus.php \Drupal\cms_content_sync\Controller\SetFlowStatus::setStatus()
Set flow status.
Parameters
mixed $cms_content_sync_flow:
1 string reference to 'SetFlowStatus::setStatus'
File
- src/
Controller/ SetFlowStatus.php, line 19
Class
- SetFlowStatus
- Pull controller.
Namespace
Drupal\cms_content_sync\ControllerCode
public function setStatus($cms_content_sync_flow) {
/**
* @var \Drupal\cms_content_sync\Entity\Flow $flow
*/
$flow = \Drupal::entityTypeManager()
->getStorage('cms_content_sync_flow')
->load($cms_content_sync_flow);
if ($flow
->status()) {
$flow
->set('status', false);
\Drupal::messenger()
->addMessage($this
->t('The flow @flow_name has been disabled.', [
'@flow_name' => $flow
->label(),
]));
}
else {
$flow
->set('status', true);
\Drupal::messenger()
->addMessage($this
->t('The flow @flow_name has been enabled.', [
'@flow_name' => $flow
->label(),
]));
}
$flow
->save();
return new RedirectResponse(Url::fromRoute('entity.cms_content_sync_flow.collection')
->toString());
}