openlayers-8.x-4.x-dev/src/Form/MapInteractionEditForm.php
src/Form/MapInteractionEditForm.php
<?php
namespace Drupal\openlayers\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\openlayers\OpenlayersMapInterface;
use Drupal\openlayers\OpenlayersInteractionInterface;
/**
* Provides an edit form for .....
*
* @internal
*/
class MapInteractionEditForm extends MapInteractionFormBase {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, OpenlayersMapInterface $map = NULL, $interaction = NULL) {
$form = parent::buildForm($form, $form_state, $map, $interaction);
// $form['#title'] = $this->t('Edit %label interaction', ['%label' => $this->mapInteraction->label()]);
$form['actions']['submit']['#value'] = $this->t('Update interaction');
return $form;
}
/**
* {@inheritdoc}
*/
protected function prepareMapInteraction($interaction) {
// Invoke the plugin class
$plugin_type = \Drupal::service('plugin.manager.openlayers.interaction');
// Create a preconfigured instance of a plugin
$interactionInstance = $plugin_type->createInstance($this->map->interactions[$interaction]['id'], $this->map->interactions[$interaction]);
/*
// Set configuration options
$configuration = $interactionInstance->configuration;
// $configuration['id'] = $interaction;
$interactionInstance->configuration = $configuration;
*/
return $interactionInstance;
}
}
