Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Component/Plugin/Derivative/DeriverBase.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 } |