You are here

public function ExampleConfigurableTextBlock::defaultConfiguration in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/block_example/src/Plugin/Block/ExampleConfigurableTextBlock.php \Drupal\block_example\Plugin\Block\ExampleConfigurableTextBlock::defaultConfiguration()

This method sets the block default configuration. This configuration determines the block's behavior when a block is initially placed in a region. Default values for the block configuration form should be added to the configuration array. System default configurations are assembled in BlockBase::__construct() e.g. cache setting and block title visibility.

Overrides BlockPluginTrait::defaultConfiguration

See also

\Drupal\block\BlockBase::__construct()

File

block_example/src/Plugin/Block/ExampleConfigurableTextBlock.php, line 33

Class

ExampleConfigurableTextBlock
Provides a 'Example: configurable text string' block.

Namespace

Drupal\block_example\Plugin\Block

Code

public function defaultConfiguration() {
  return [
    'block_example_string' => $this
      ->t('A default value. This block was created at %time', [
      '%time' => date('c'),
    ]),
  ];
}