DynamicCopyField.php in Display Suite 8.4
File
src/Plugin/DsField/DynamicCopyField.php
View source
<?php
namespace Drupal\ds\Plugin\DsField;
use Drupal\Core\Form\FormStateInterface;
use Drupal\ds\Plugin\DsPluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class DynamicCopyField extends DsFieldBase {
private $fieldInstance;
public function __construct($configuration, $plugin_id, $plugin_definition, DsPluginManager $plugin_Manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->fieldInstance = $plugin_Manager
->createInstance($plugin_definition['properties']['ds_plugin'], $configuration);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('plugin.manager.ds'));
}
public function build() {
return $this->fieldInstance
->build();
}
public function settingsForm($form, FormStateInterface $form_state) {
return $this->fieldInstance
->settingsForm($form, $form_state);
}
public function settingsSummary($settings) {
return $this->fieldInstance
->settingsSummary($settings);
}
public function getConfiguration() {
return $this->fieldInstance
->getConfiguration();
}
public function setConfiguration(array $configuration) {
return $this->fieldInstance
->setConfiguration($configuration);
}
public function defaultConfiguration() {
return [];
}
public function formatters() {
return $this->fieldInstance
->formatters();
}
}
Classes
Name |
Description |
DynamicCopyField |
Defines a generic dynamic field that holds a copy of an existing ds field. |