public function VocabularyDevelGenerate::generateElements in Devel 4.x
Same name and namespace in other branches
- 8.3 devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::generateElements()
- 8 devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::generateElements()
- 8.2 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 96
Class
- VocabularyDevelGenerate
- Provides a VocabularyDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
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', [
'@vocs' => implode(', ', $new_vocs),
]));
}
}