MutliValueKeyInput.php in Key 8
File
tests/modules/key_test/src/Plugin/KeyInput/MutliValueKeyInput.php
View source
<?php
namespace Drupal\key_test\Plugin\KeyInput;
use Drupal\Core\Form\FormStateInterface;
use Drupal\key\Plugin\KeyInputBase;
class MutliValueKeyInput extends KeyInputBase {
public function defaultConfiguration() {
return parent::defaultConfiguration() + [
'first' => '',
'second' => '',
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
return $form + [
'first' => [
'#type' => 'textfield',
'#default_value' => $this->configuration['first'],
'#title' => $this
->t('First'),
],
'second' => [
'#type' => 'textfield',
'#default_value' => $this->configuration['second'],
'#title' => $this
->t('Second'),
],
];
}
}