You are here

class JuicerEmbedFeedBlockDerivative in Juicer - Social Media Feed Aggregator 8

Class JuicerEmbedFeedBlockDerivative.

@package Drupal\juicerio\Plugin\Derivative.

Hierarchy

Expanded class hierarchy of JuicerEmbedFeedBlockDerivative

File

src/Plugin/Derivative/JuicerEmbedFeedBlockDerivative.php, line 21
Contains \Drupal\juicerio\src\Plugin\Derivative\JuicerEmbedFeedBlockDerivative.

Namespace

Drupal\juicerio\Plugin\Derivative
View source
class JuicerEmbedFeedBlockDerivative extends DeriverBase implements ContainerDeriverInterface {
  use StringTranslationTrait;

  /**
   * The Drupal config factory service.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs a global locator.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The Drupal config factory service.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('config.factory'));
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $count = $this->configFactory
      ->get('juicerio.settings')
      ->get('juicer_blocks');
    for ($delta = 1; $delta <= $count; $delta++) {
      $info = $this
        ->t('Juicer Embed Feed');
      $this->derivatives['juicerio_' . $delta] = $base_plugin_definition;
      $this->derivatives['juicerio_' . $delta]['admin_label'] = $this
        ->t('@info @delta', [
        '@info' => $info,
        '@delta' => $delta,
      ]);
    }
    return $this->derivatives;
  }

}

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
JuicerEmbedFeedBlockDerivative::$configFactory protected property The Drupal config factory service.
JuicerEmbedFeedBlockDerivative::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
JuicerEmbedFeedBlockDerivative::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
JuicerEmbedFeedBlockDerivative::__construct public function Constructs a global locator.
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.