3 namespace Drupal\workspaces\Form;
5 use Drupal\Core\Entity\ContentEntityDeleteForm;
6 use Drupal\Core\Form\FormStateInterface;
9 * Provides a form for deleting a workspace.
13 class WorkspaceDeleteForm extends ContentEntityDeleteForm implements WorkspaceFormInterface {
16 * The workspace entity.
18 * @var \Drupal\workspaces\WorkspaceInterface
25 public function buildForm(array $form, FormStateInterface $form_state) {
26 $form = parent::buildForm($form, $form_state);
27 $source_rev_diff = $this->entityTypeManager->getStorage('workspace_association')->getTrackedEntities($this->entity->id());
29 foreach ($source_rev_diff as $entity_type_id => $revision_ids) {
30 $label = $this->entityTypeManager->getDefinition($entity_type_id)->getLabel();
31 $items[] = $this->formatPlural(count($revision_ids), '1 @label revision.', '@count @label revisions.', ['@label' => $label]);
33 $form['revisions'] = [
34 '#theme' => 'item_list',
35 '#title' => $this->t('The following will also be deleted:'),
45 public function getDescription() {
46 return $this->t('This action cannot be undone, and will also delete all content created in this workspace.');