You are here

public function CurrentThemeBlock::build in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 8.2 tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  2. 3.0.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  3. 3.1.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  4. 3.2.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  5. 3.3.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  6. 3.4.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  7. 3.5.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  8. 3.6.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  9. 3.7.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
  10. 3.8.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()

Builds and returns the renderable array for this block plugin.

If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).

Return value

array A renderable array representing the content of the block.

Overrides BlockPluginInterface::build

See also

\Drupal\block\BlockViewBuilder

File

tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php, line 20

Class

CurrentThemeBlock
Block that shows the current theme.

Namespace

Drupal\lingotek_test\Plugin\Block

Code

public function build() {
  $theme = \Drupal::theme()
    ->getActiveTheme()
    ->getName();
  return [
    '#markup' => $this
      ->t('Current theme: @theme', [
      '@theme' => $theme,
    ]),
  ];
}