You are here

public function ParagraphController::deleteParagraph in Paragraphs admin 8

Deletes paragraph content.

Parameters

\Drupal\paragraphs\ParagraphInterface $paragraph: Paragraph to be deleted.

1 string reference to 'ParagraphController::deleteParagraph'
paragraphs_admin.routing.yml in ./paragraphs_admin.routing.yml
paragraphs_admin.routing.yml

File

src/Controller/ParagraphController.php, line 47

Class

ParagraphController
Controller for paragraphs admin.

Namespace

Drupal\paragraphs_admin\Controller

Code

public function deleteParagraph(ParagraphInterface $paragraph) {
  $pid = $paragraph
    ->id();
  $paragraph
    ->delete();
  $this->messenger
    ->addMessage($this
    ->t('Paragraph @pid deleted.', [
    '@pid' => $pid,
  ]));

  // Redirect back to view node page.
  return $this
    ->redirect('view.paragraphs.page_admin_paragraphs');
}