You are here

public function ParagraphDeleteForm::getQuestion in Paragraphs Edit 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/ParagraphDeleteForm.php, line 16

Class

ParagraphDeleteForm
Provides a form for deleting a paragraph from a node.

Namespace

Drupal\paragraphs_edit

Code

public function getQuestion() {
  $route_match = $this
    ->getRouteMatch();

  /** @var \Drupal\node\NodeInterface $node */
  $node = $route_match
    ->getParameter('node');
  $field_name = $route_match
    ->getParameter('field');
  $field = $node
    ->get($field_name);
  $field_definition = $field
    ->getFieldDefinition();
  $field_label = $field_definition
    ->getLabel();
  $delta = $route_match
    ->getParameter('delta');
  return $this
    ->t('Are you sure you want to delete #@delta of @field of %label?', [
    '@delta' => $delta,
    '@field' => $field_label,
    '%label' => $node
      ->label(),
  ]);
}