74 lines
1.6 KiB
PHP
74 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Drupal\entity_browser;
|
|
|
|
use Drupal\Core\Entity\EntityTypeInterface;
|
|
use Drupal\Core\Form\FormStateInterface;
|
|
use Drupal\Core\Plugin\PluginBase;
|
|
|
|
/**
|
|
* Base implementation for field widget display plugins.
|
|
*/
|
|
abstract class FieldWidgetDisplayBase extends PluginBase implements FieldWidgetDisplayInterface {
|
|
|
|
/**
|
|
* Constructs field widget display plugin.
|
|
*
|
|
* @param array $configuration
|
|
* A configuration array containing information about the plugin instance.
|
|
* @param string $plugin_id
|
|
* The plugin_id for the plugin instance.
|
|
* @param mixed $plugin_definition
|
|
* The plugin implementation definition.
|
|
*/
|
|
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
|
|
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
|
$this->setConfiguration($configuration);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function settingsForm(array $form, FormStateInterface $form_state) {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function isApplicable(EntityTypeInterface $entity_type) {
|
|
return TRUE;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getConfiguration() {
|
|
return $this->configuration;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function setConfiguration(array $configuration) {
|
|
$configuration += $this->defaultConfiguration();
|
|
|
|
$this->configuration = $configuration;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function calculateDependencies() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function defaultConfiguration() {
|
|
return [];
|
|
}
|
|
|
|
}
|