logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll
13/04/2025, by Ivan

Menu

To use block instance configuration, we can modify the build() method of the HelloBlock class:

/**
 * {@inheritdoc}
 */  
public function build() {
  $config = $this->getConfiguration();

  if (!empty($config['hello_block_name'])) {
    $name = $config['hello_block_name'];
  }
  else {
    $name = $this->t('to no one');
  }

  return [
    '#markup' => $this->t('Hello @name!', [
      '@name' => $name,
    ]),
  ];
}