Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / workflows / src / Form / WorkflowDeleteForm.php
index b9b833132b73ffb8c79b9a6eed722eabc336be97..e122f4054346bb6f102aeec95d46baed30c7fc77 100644 (file)
@@ -11,6 +11,19 @@ use Drupal\Core\Url;
  */
 class WorkflowDeleteForm extends EntityConfirmFormBase {
 
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    if ($this->entity->getTypePlugin()->workflowHasData($this->entity)) {
+      $form['#title'] = $this->getQuestion();
+      $form['description'] = ['#markup' => $this->t('This workflow is in use. You cannot remove this workflow until you have removed all content using it.')];
+      return $form;
+    }
+
+    return parent::buildForm($form, $form_state);
+  }
+
   /**
    * {@inheritdoc}
    */