SimpleClass.php in Block Style Plugins 8
File
tests/modules/block_style_plugins_test/src/Plugin/BlockStyle/SimpleClass.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 SimpleClass extends BlockStyleBase {
public function defaultConfiguration() {
return [
'simple_class' => '',
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$elements['simple_class'] = [
'#type' => 'textfield',
'#title' => $this
->t('Add a custom class to this block'),
'#description' => $this
->t('Do not add the "period" to the start of the class'),
'#default_value' => $this->configuration['simple_class'],
];
return $elements;
}
}
Classes
Name |
Description |
SimpleClass |
Provides a 'SimpleClass' block style for adding a class in a text field. |