public function CurrentThemeBlock::build in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8.2 tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 4.0.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.0.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.1.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.2.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.4.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.5.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.6.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 3.7.x tests/modules/lingotek_test/src/Plugin/Block/CurrentThemeBlock.php \Drupal\lingotek_test\Plugin\Block\CurrentThemeBlock::build()
- 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\BlockCode
public function build() {
$theme = \Drupal::theme()
->getActiveTheme()
->getName();
return [
'#markup' => $this
->t('Current theme: @theme', [
'@theme' => $theme,
]),
];
}