Mercurial > hg > isophonics-drupal-site
comparison modules/contrib/views_slideshow/src/ViewsSlideshowWidgetBase.php @ 5:c69a71b4f40f
Add slideshow module
author | Chris Cannam |
---|---|
date | Thu, 07 Dec 2017 14:46:23 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:8948ab6c87d2 | 5:c69a71b4f40f |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\views_slideshow; | |
4 | |
5 use Drupal\Component\Plugin\PluginBase; | |
6 use Drupal\Core\Form\FormStateInterface; | |
7 use Drupal\Core\StringTranslation\StringTranslationTrait; | |
8 | |
9 /** | |
10 * Provides basic functionality for Views slideshow widgets. | |
11 */ | |
12 abstract class ViewsSlideshowWidgetBase extends PluginBase implements ViewsSlideshowWidgetInterface { | |
13 use StringTranslationTrait; | |
14 | |
15 /** | |
16 * {@inheritdoc} | |
17 */ | |
18 public function __construct(array $configuration, $plugin_id, $plugin_definition) { | |
19 parent::__construct($configuration, $plugin_id, $plugin_definition); | |
20 | |
21 $this->setConfiguration($configuration); | |
22 } | |
23 | |
24 /** | |
25 * {@inheritdoc} | |
26 */ | |
27 public function getTitle() { | |
28 return $this->pluginDefinition['title']; | |
29 } | |
30 | |
31 /** | |
32 * {@inheritdoc} | |
33 */ | |
34 public function buildConfigurationForm(array $form, FormStateInterface $form_state) { | |
35 return []; | |
36 } | |
37 | |
38 /** | |
39 * {@inheritdoc} | |
40 */ | |
41 public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { | |
42 } | |
43 | |
44 /** | |
45 * {@inheritdoc} | |
46 */ | |
47 public function defaultConfiguration() { | |
48 return []; | |
49 } | |
50 | |
51 /** | |
52 * {@inheritdoc} | |
53 */ | |
54 public function getConfiguration() { | |
55 return [ | |
56 'id' => $this->getPluginId(), | |
57 ] + $this->configuration; | |
58 } | |
59 | |
60 /** | |
61 * {@inheritdoc} | |
62 */ | |
63 public function setConfiguration(array $configuration) { | |
64 $this->configuration = $configuration + $this->defaultConfiguration(); | |
65 return $this; | |
66 } | |
67 | |
68 /** | |
69 * {@inheritdoc} | |
70 */ | |
71 public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { | |
72 } | |
73 | |
74 /** | |
75 * {@inheritdoc} | |
76 */ | |
77 public function calculateDependencies() { | |
78 return []; | |
79 } | |
80 | |
81 /** | |
82 * {@inheritdoc} | |
83 */ | |
84 public function checkCompatiblity($view) { | |
85 return TRUE; | |
86 } | |
87 | |
88 } |