DropdownWithInclude.php in Block Style Plugins 8.2
File
tests/modules/block_style_plugins_test/src/Plugin/BlockStyle/DropdownWithInclude.php
View source
<?php
namespace Drupal\block_style_plugins_test\Plugin\BlockStyle;
use Drupal\block_style_plugins\Plugin\BlockStyleBase;
use Drupal\Core\Form\FormStateInterface;
class DropdownWithInclude extends BlockStyleBase {
public function defaultConfiguration() {
return [
'dropdown_class' => 'style-3',
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$elements['dropdown_class'] = [
'#type' => 'select',
'#title' => $this
->t('Choose a style from the dropdown'),
'#options' => [
'style-1' => $this
->t('Style 1'),
'style-2' => $this
->t('Style 2'),
'style-3' => $this
->t('Style 3'),
],
'#default_value' => $this->configuration['dropdown_class'],
];
return $elements;
}
}