Mercurial > hg > isophonics-drupal-site
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/contrib/views_slideshow/src/ViewsSlideshowWidgetBase.php Thu Dec 07 14:46:23 2017 +0000 @@ -0,0 +1,88 @@ +<?php + +namespace Drupal\views_slideshow; + +use Drupal\Component\Plugin\PluginBase; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\StringTranslation\StringTranslationTrait; + +/** + * Provides basic functionality for Views slideshow widgets. + */ +abstract class ViewsSlideshowWidgetBase extends PluginBase implements ViewsSlideshowWidgetInterface { + use StringTranslationTrait; + + /** + * {@inheritdoc} + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + + $this->setConfiguration($configuration); + } + + /** + * {@inheritdoc} + */ + public function getTitle() { + return $this->pluginDefinition['title']; + } + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(array $form, FormStateInterface $form_state) { + return []; + } + + /** + * {@inheritdoc} + */ + public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { + } + + /** + * {@inheritdoc} + */ + public function defaultConfiguration() { + return []; + } + + /** + * {@inheritdoc} + */ + public function getConfiguration() { + return [ + 'id' => $this->getPluginId(), + ] + $this->configuration; + } + + /** + * {@inheritdoc} + */ + public function setConfiguration(array $configuration) { + $this->configuration = $configuration + $this->defaultConfiguration(); + return $this; + } + + /** + * {@inheritdoc} + */ + public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { + } + + /** + * {@inheritdoc} + */ + public function calculateDependencies() { + return []; + } + + /** + * {@inheritdoc} + */ + public function checkCompatiblity($view) { + return TRUE; + } + +}