function VocabularyDevelGenerate::generateElements

Same name in other branches
  1. 8.x-1.x devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::generateElements()
  2. 4.x devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::generateElements()

Overrides DevelGenerateBase::generateElements

File

devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php, line 80

Class

VocabularyDevelGenerate
Provides a VocabularyDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

protected function generateElements(array $values) : void {
    if ($values['kill']) {
        $this->deleteVocabularies();
        $this->setMessage($this->t('Deleted existing vocabularies.'));
    }
    $new_vocs = $this->generateVocabularies($values['num'], $values['title_length']);
    if ($new_vocs !== []) {
        $this->setMessage($this->t('Created the following new vocabularies: @vocs', [
            '@vocs' => implode(', ', $new_vocs),
        ]));
    }
}