You are here

class TagcloudsTermsBlock in TagCloud 8

Same name in this branch
  1. 8 src/Plugin/Derivative/TagcloudsTermsBlock.php \Drupal\tagclouds\Plugin\Derivative\TagcloudsTermsBlock
  2. 8 src/Plugin/Block/TagcloudsTermsBlock.php \Drupal\tagclouds\Plugin\Block\TagcloudsTermsBlock
Same name and namespace in other branches
  1. 2.0.x src/Plugin/Derivative/TagcloudsTermsBlock.php \Drupal\tagclouds\Plugin\Derivative\TagcloudsTermsBlock
  2. 1.0.x src/Plugin/Derivative/TagcloudsTermsBlock.php \Drupal\tagclouds\Plugin\Derivative\TagcloudsTermsBlock

Provides dynamic definitions for tagclouds blocks based on Voacabularies.

Hierarchy

Expanded class hierarchy of TagcloudsTermsBlock

See also

\Drupal\tagclouds\Plugin\Block\TagcloudsTermsBlock

Plugin API

File

src/Plugin/Derivative/TagcloudsTermsBlock.php, line 16

Namespace

Drupal\tagclouds\Plugin\Derivative
View source
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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
TagcloudsTermsBlock::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions