Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Action/ConfigurableActionBase.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Core\Action; | |
4 | |
5 use Drupal\Component\Plugin\ConfigurablePluginInterface; | |
6 use Drupal\Core\Form\FormStateInterface; | |
7 use Drupal\Core\Plugin\PluginFormInterface; | |
8 | |
9 /** | |
10 * Provides a base implementation for a configurable Action plugin. | |
11 */ | |
12 abstract class ConfigurableActionBase extends ActionBase implements ConfigurablePluginInterface, PluginFormInterface { | |
13 | |
14 /** | |
15 * {@inheritdoc} | |
16 */ | |
17 public function __construct(array $configuration, $plugin_id, $plugin_definition) { | |
18 parent::__construct($configuration, $plugin_id, $plugin_definition); | |
19 | |
20 $this->setConfiguration($configuration); | |
21 } | |
22 | |
23 /** | |
24 * {@inheritdoc} | |
25 */ | |
26 public function defaultConfiguration() { | |
27 return []; | |
28 } | |
29 | |
30 /** | |
31 * {@inheritdoc} | |
32 */ | |
33 public function getConfiguration() { | |
34 return $this->configuration; | |
35 } | |
36 | |
37 /** | |
38 * {@inheritdoc} | |
39 */ | |
40 public function setConfiguration(array $configuration) { | |
41 $this->configuration = $configuration + $this->defaultConfiguration(); | |
42 } | |
43 | |
44 /** | |
45 * {@inheritdoc} | |
46 */ | |
47 public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { | |
48 } | |
49 | |
50 /** | |
51 * {@inheritdoc} | |
52 */ | |
53 public function calculateDependencies() { | |
54 return []; | |
55 } | |
56 | |
57 } |