You are here

protected function ContentDevelGenerate::contentKill in Devel 8

Same name and namespace in other branches
  1. 8.3 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::contentKill()
  2. 8.2 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::contentKill()
  3. 4.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::contentKill()

Deletes all nodes of given node types.

Parameters

array $values: The input values from the settings form.

2 calls to ContentDevelGenerate::contentKill()
ContentDevelGenerate::batchContentKill in devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php
ContentDevelGenerate::generateContent in devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php
Method responsible for creating content when the number of elements is less than 50.

File

devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php, line 422

Class

ContentDevelGenerate
Provides a ContentDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

protected function contentKill($values) {
  $nids = $this->nodeStorage
    ->getQuery()
    ->condition('type', $values['node_types'], 'IN')
    ->execute();
  if (!empty($nids)) {
    $nodes = $this->nodeStorage
      ->loadMultiple($nids);
    $this->nodeStorage
      ->delete($nodes);
    $this
      ->setMessage($this
      ->t('Deleted %count nodes.', array(
      '%count' => count($nids),
    )));
  }
}