You are here

public function ComponentBlock::defaultConfiguration in Component blocks 1.1.x

Same name and namespace in other branches
  1. 1.x src/Plugin/Block/ComponentBlock.php \Drupal\component_blocks\Plugin\Block\ComponentBlock::defaultConfiguration()
  2. 1.0.x src/Plugin/Block/ComponentBlock.php \Drupal\component_blocks\Plugin\Block\ComponentBlock::defaultConfiguration()

Overrides BlockPluginTrait::defaultConfiguration

1 call to ComponentBlock::defaultConfiguration()
ComponentBlock::setConfiguration in src/Plugin/Block/ComponentBlock.php

File

src/Plugin/Block/ComponentBlock.php, line 171

Class

ComponentBlock
Defines a class for a specially shaped block.

Namespace

Drupal\component_blocks\Plugin\Block

Code

public function defaultConfiguration() {
  $plugin = $this
    ->uiPatternsManager()
    ->getDefinition($this->pluginDefinition['ui_pattern_id']);
  $defaults = array_map(function (PatternDefinitionField $item) {
    return [
      'source' => self::FIXED,
      'value' => $item['default'] ?? '',
    ];
  }, $plugin['fields']);
  return [
    'label_display' => FALSE,
    'variant' => NULL,
    'variables' => $defaults,
    'settings' => [],
  ];
}