TagcloudsTermsBlock.php in TagCloud 8
Same filename in this branch
Same filename and directory in other branches
Namespace
Drupal\tagclouds\Plugin\DerivativeFile
src/Plugin/Derivative/TagcloudsTermsBlock.phpView source
<?php
namespace Drupal\tagclouds\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Component\Plugin\Derivative\DeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Provides dynamic definitions for tagclouds blocks based on Voacabularies.
*
* @see \Drupal\tagclouds\Plugin\Block\TagcloudsTermsBlock
* @see plugin_api
*/
class TagcloudsTermsBlock extends DeriverBase implements DeriverInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach (Vocabulary::loadMultiple() as $voc) {
$this->derivatives[$voc
->id()] = $base_plugin_definition;
$this->derivatives[$voc
->id()]['admin_label'] = $this
->t('Tags in @voc', [
'@voc' => $voc
->label(),
]);
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Classes
Name | Description |
---|---|
TagcloudsTermsBlock | Provides dynamic definitions for tagclouds blocks based on Voacabularies. |