public function OrganigramsBlocks::getDerivativeDefinitions in Organigrams 8
Same name and namespace in other branches
- 8.2 src/Plugin/Derivative/OrganigramsBlocks.php \Drupal\organigrams\Plugin\Derivative\OrganigramsBlocks::getDerivativeDefinitions()
Create a block for every organigram.
Overrides DeriverBase::getDerivativeDefinitions
File
- src/
Plugin/ Derivative/ OrganigramsBlocks.php, line 48
Class
- OrganigramsBlocks
- Provides block plugin definitions for organigrams.
Namespace
Drupal\organigrams\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
// Load all vocabularies and iterate through them.
$taxonomy_vocabularies = $this->taxonomyStorage
->loadMultiple();
foreach ($taxonomy_vocabularies as $vocabulary) {
// Skip if the vocabulary has no organigrams settings.
if (empty($vocabulary
->getThirdPartySettings('organigrams'))) {
continue;
}
// Create the block.
$this->derivatives[$vocabulary
->id()] = $base_plugin_definition;
$this->derivatives[$vocabulary
->id()]['admin_label'] = t('Organigram block:') . ' ' . $vocabulary
->label();
}
return $this->derivatives;
}