You are here

DeriverBase.php in Service Container 7

Same filename and directory in other branches
  1. 7.2 lib/Drupal/Component/Plugin/Derivative/DeriverBase.php

File

lib/Drupal/Component/Plugin/Derivative/DeriverBase.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Component\Plugin\Derivative\DeriverBase.
 */
namespace Drupal\Component\Plugin\Derivative;


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

}

Classes

Namesort descending Description
DeriverBase Provides a basic deriver.