You are here

public function GeysirParagraphDeleteForm::getQuestion in Geysir 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 ContentEntityDeleteForm::getQuestion

File

src/Form/GeysirParagraphDeleteForm.php, line 18

Class

GeysirParagraphDeleteForm
Functionality to delete a paragraph.

Namespace

Drupal\geysir\Form

Code

public function getQuestion() {
  $route_match = $this
    ->getRouteMatch();
  $parent_entity_type = $route_match
    ->getParameter('parent_entity_type');
  $parent_entity_revision = $route_match
    ->getParameter('parent_entity_revision');
  $field_name = $route_match
    ->getParameter('field');
  $delta = $route_match
    ->getParameter('delta');

  // Get the parent revision if available, otherwise the parent.
  $parent_entity_revision = $this
    ->getParentRevisionOrParent($parent_entity_type, $parent_entity_revision);
  $field = $parent_entity_revision
    ->get($field_name);
  $field_definition = $field
    ->getFieldDefinition();
  $field_label = $field_definition
    ->getLabel();
  return $this
    ->t('Are you sure you want to delete #@delta of @field of %label?', [
    '@delta' => $delta,
    '@field' => $field_label,
    '%label' => $parent_entity_revision
      ->label(),
  ]);
}