You are here

public function VocabularyDevelGenerate::generateElements in Devel 8.2

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

Business logic relating with each DevelGenerate plugin

Parameters

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

Overrides DevelGenerateBase::generateElements

File

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

Class

VocabularyDevelGenerate
Provides a VocabularyDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

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