class DeriverBase

Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/Derivative/DeriverBase.php \Drupal\Component\Plugin\Derivative\DeriverBase
  2. 10 core/lib/Drupal/Component/Plugin/Derivative/DeriverBase.php \Drupal\Component\Plugin\Derivative\DeriverBase
  3. 11.x core/lib/Drupal/Component/Plugin/Derivative/DeriverBase.php \Drupal\Component\Plugin\Derivative\DeriverBase

Provides a basic deriver.

Hierarchy

Expanded class hierarchy of DeriverBase

39 files declare their use of DeriverBase
BlockContent.php in core/modules/block_content/src/Plugin/Derivative/BlockContent.php
ConfigTranslationContextualLinks.php in core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationContextualLinks.php
ConfigTranslationLocalTasks.php in core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationLocalTasks.php
ContentEntityDeriver.php in core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntityDeriver.php
ContentTranslationContextualLinks.php in core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php

... See full list

File

core/lib/Drupal/Component/Plugin/Derivative/DeriverBase.php, line 8

Namespace

Drupal\Component\Plugin\Derivative
View source
abstract class DeriverBase implements DeriverInterface {
    
    /**
     * List of derivative definitions.
     *
     * @var array
     */
    protected $derivatives = [];
    
    /**
     * {@inheritdoc}
     */
    public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
        if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
            return $this->derivatives[$derivative_id];
        }
        $this->getDerivativeDefinitions($base_plugin_definition);
        return $this->derivatives[$derivative_id];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDerivativeDefinitions($base_plugin_definition) {
        return $this->derivatives;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
DeriverBase::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface::getDerivativeDefinitions 39

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.