public function WorkspaceDeleteForm::buildForm in Workspace 8.2
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ContentEntityDeleteForm::buildForm
File
- src/
Form/ WorkspaceDeleteForm.php, line 25
Class
- WorkspaceDeleteForm
- Provides a form for deleting a workspace.
Namespace
Drupal\workspace\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$source_rev_diff = $this->entity
->getRepositoryHandler()
->getDifferringRevisionIdsOnSource();
$items = [];
foreach ($source_rev_diff as $entity_type_id => $revision_ids) {
$label = $this->entityTypeManager
->getDefinition($entity_type_id)
->getLabel();
$items[] = $this
->formatPlural(count($revision_ids), '1 @label revision.', '@count @label revisions.', [
'@label' => $label,
]);
}
$form['revisions'] = [
'#theme' => 'item_list',
'#title' => $this
->t('The following will also be deleted:'),
'#items' => $items,
];
return $form;
}