logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll
04/10/2025, by Ivan

Menu

Om de configuratie van block-instanties te gebruiken, kunnen we de methode build() van de klasse HelloBlock aanpassen:

  /**
   * {@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,
      ]),
    ];
  }