Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Component / Plugin / Derivative / DeriverBase.php
1 <?php
2
3 namespace Drupal\Component\Plugin\Derivative;
4
5 /**
6  * Provides a basic deriver.
7  */
8 abstract class DeriverBase implements DeriverInterface {
9
10   /**
11    * List of derivative definitions.
12    *
13    * @var array
14    */
15   protected $derivatives = [];
16
17   /**
18    * {@inheritdoc}
19    */
20   public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
21     if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
22       return $this->derivatives[$derivative_id];
23     }
24     $this->getDerivativeDefinitions($base_plugin_definition);
25     return $this->derivatives[$derivative_id];
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function getDerivativeDefinitions($base_plugin_definition) {
32     return $this->derivatives;
33   }
34
35 }