You are here

abstract class DeriverBase in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Component/Plugin/Derivative/DeriverBase.php \Drupal\Component\Plugin\Derivative\DeriverBase

Provides a basic deriver.

Hierarchy

Expanded class hierarchy of DeriverBase

File

lib/Drupal/Component/Plugin/Derivative/DeriverBase.php, line 13
Contains \Drupal\Component\Plugin\Derivative\DeriverBase.

Namespace

Drupal\Component\Plugin\Derivative
View source
abstract class DeriverBase implements DeriverInterface {

  /**
   * List of derivative definitions.
   *
   * @var array
   */
  protected $derivatives = array();

  /**
   * {@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

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions.
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