DeriverBase.php

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

Namespace

Drupal\Component\Plugin\Derivative

File

core/lib/Drupal/Component/Plugin/Derivative/DeriverBase.php

View source
<?php

namespace Drupal\Component\Plugin\Derivative;


/**
 * Provides a basic deriver.
 */
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;
    }

}

Classes

Title Deprecated Summary
DeriverBase Provides a basic deriver.

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