abstract class CustomHTMLBlockBase in Content Planner 8
The base class for block base.
@todo Plugin derivates should be used instead of a class hierarchy here.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\content_planner\DashboardBlockBase implements DashboardBlockInterface, ContainerFactoryPluginInterface uses ConfigFormBaseTrait
- class \Drupal\content_planner\Plugin\DashboardBlock\CustomHTMLBlockBase
- class \Drupal\content_planner\DashboardBlockBase implements DashboardBlockInterface, ContainerFactoryPluginInterface uses ConfigFormBaseTrait
Expanded class hierarchy of CustomHTMLBlockBase
File
- src/
Plugin/ DashboardBlock/ CustomHTMLBlockBase.php, line 14
Namespace
Drupal\content_planner\Plugin\DashboardBlockView source
abstract class CustomHTMLBlockBase extends DashboardBlockBase {
/**
* Builds the render array for the block.
*
* @return array
* The render array for the block.
*/
public function build() {
$build = [];
// Get config.
$config = $this
->getConfiguration();
if (isset($config['plugin_specific_config']['content'])) {
$build = [
'#markup' => check_markup($config['plugin_specific_config']['content']['value'], $config['plugin_specific_config']['content']['format']),
];
}
return $build;
}
/**
* {@inheritdoc}
*/
public function getConfigSpecificFormFields(FormStateInterface &$form_state, Request &$request, array $block_configuration) {
$form = [];
if (!empty($block_configuration['plugin_specific_config']['content']['value'])) {
$default_value = $block_configuration['plugin_specific_config']['content']['value'];
}
else {
$default_value = '';
}
$form['content'] = [
'#type' => 'text_format',
'#title' => t('Content'),
'#format' => 'full_html',
'#default_value' => $default_value,
];
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
CustomHTMLBlockBase:: |
public | function |
Builds the render array for the block. Overrides DashboardBlockBase:: |
|
CustomHTMLBlockBase:: |
public | function |
Add additonal form elements specific to the Plugin. Overrides DashboardBlockBase:: |
|
DashboardBlockBase:: |
protected | property | The route match. | |
DashboardBlockBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
2 |
DashboardBlockBase:: |
public static | function | Get basic configuration structure for the block configuration. | |
DashboardBlockBase:: |
public | function |
Get Configuration passed in by Plugin Manager. Overrides DashboardBlockInterface:: |
|
DashboardBlockBase:: |
protected | function | Get custom config. | |
DashboardBlockBase:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
DashboardBlockBase:: |
public | function |
Return the name of the block. Overrides DashboardBlockInterface:: |
|
DashboardBlockBase:: |
public | function |
Determines if the plugin is configurable. Overrides PluginBase:: |
|
DashboardBlockBase:: |
public | function |
Submit form handler. Overrides DashboardBlockInterface:: |
|
DashboardBlockBase:: |
public | function |
Validates teh plugin config form. Overrides DashboardBlockInterface:: |
|
DashboardBlockBase:: |
public | function |
Constructs a new UserLoginBlock instance. Overrides PluginBase:: |
2 |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |