You are here

private function MergeTranslationsForm::removeNode in Merge translations 8

Remove node.

Parameters

\Drupal\node\NodeInterface $node_source: Node_source.

Return value

bool|\Exception Status of operation.

1 call to MergeTranslationsForm::removeNode()
MergeTranslationsForm::submitForm in src/Form/MergeTranslationsForm.php
SubmitForm.

File

src/Form/MergeTranslationsForm.php, line 300

Class

MergeTranslationsForm
The merge translation form.

Namespace

Drupal\merge_translations\Form

Code

private function removeNode(NodeInterface $node_source) {
  if (!$node_source
    ->access('delete')) {
    return FALSE;
  }
  try {
    $this->messenger
      ->addStatus($this
      ->t('Node @node has been removed.', [
      '@node' => $node_source
        ->getTitle(),
    ]));
    $node_source
      ->delete();
    return TRUE;
  } catch (\Exception $e) {
    return $e;
  }
}