public function WorkflowTransitionRevertForm::getQuestion in Workflow 8
Returns the question to ask the user.
Return value
\Drupal\Core\StringTranslation\TranslatableMarkup The form question. The page title will be set to this value.
Overrides ConfirmFormInterface::getQuestion
File
- src/
Form/ WorkflowTransitionRevertForm.php, line 29
Class
- WorkflowTransitionRevertForm
- Implements a form to revert an entity to a previous state.
Namespace
Drupal\workflow\FormCode
public function getQuestion() {
/** @var \Drupal\workflow\Entity\WorkflowTransitionInterface $transition */
$transition = $this->entity;
$state = $transition
->getFromState();
if (!$state) {
\Drupal::logger('workflow_revert')
->error('Invalid state', []);
$message = $this
->t('Invalid transition. Your information has been recorded.');
$this
->messenger()
->addError($message);
return [];
}
$question = $this
->t('Are you sure you want to revert %title to the "@state" state?', [
'@state' => $state
->label(),
'%title' => $transition
->label(),
]);
return $question;
}