You are here

protected function ParagraphDeleteForm::getDeletionMessage in Paragraphs Edit 8

Overrides ContentEntityDeleteForm::getDeletionMessage

File

src/ParagraphDeleteForm.php, line 36

Class

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

Namespace

Drupal\paragraphs_edit

Code

protected function getDeletionMessage() {
  $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('Item #@delta of @field of %label has been deleted.', [
    '@delta' => $delta,
    '@field' => $field_label,
    '%label' => $node
      ->label(),
  ]);
}