public function DomainTokenBlock::build in Domain Access 8
Build the output.
Overrides BlockPluginInterface::build
File
- domain/
src/ Plugin/ Block/ DomainTokenBlock.php, line 30
Class
- DomainTokenBlock
- Provides a token information block for a domain request.
Namespace
Drupal\domain\Plugin\BlockCode
public function build() {
/** @var \Drupal\domain\DomainInterface $domain */
$domain = \Drupal::service('domain.negotiator')
->getActiveDomain();
if (!$domain) {
return [
'#markup' => $this
->t('No domain record could be loaded.'),
];
}
$header = [
$this
->t('Token'),
$this
->t('Value'),
];
return [
'#theme' => 'table',
'#rows' => $this
->renderTokens($domain),
'#header' => $header,
];
}