Render entity labels using h6 tag

This commit is contained in:
Paul Weidner 2023-08-25 11:37:32 -07:00 committed by Michael Stenta
parent 6be3e3639c
commit 1b6b46ab9a
1 changed files with 18 additions and 14 deletions

View File

@ -74,14 +74,16 @@ class FarmMetricsBlock extends BlockBase implements ContainerFactoryPluginInterf
// Create a container for asset metrics. // Create a container for asset metrics.
$assets_label = $this->entityTypeManager->getStorage('asset')->getEntityType()->getCollectionLabel(); $assets_label = $this->entityTypeManager->getStorage('asset')->getEntityType()->getCollectionLabel();
$output['asset'] = [ $output['asset']['label'] = [
'#markup' => '<strong>' . Link::createFromRoute($assets_label, 'view.farm_asset.page')->toString() . ' (' . $this->t('active') . ')</strong>', '#type' => 'html_tag',
'metrics' => [ '#tag' => 'h6',
'#value' => Link::createFromRoute($assets_label, 'view.farm_asset.page')->toString() . ' (' . $this->t('active') . ')',
];
$output['asset']['metrics'] = [
'#type' => 'container', '#type' => 'container',
'#attributes' => [ '#attributes' => [
'class' => 'assets metrics-container', 'class' => 'assets metrics-container',
], ],
],
]; ];
$metrics = $this->getEntityMetrics('asset'); $metrics = $this->getEntityMetrics('asset');
foreach ($metrics as $metric) { foreach ($metrics as $metric) {
@ -97,14 +99,16 @@ class FarmMetricsBlock extends BlockBase implements ContainerFactoryPluginInterf
// Create a section for log metrics. // Create a section for log metrics.
$logs_label = $this->entityTypeManager->getStorage('log')->getEntityType()->getCollectionLabel(); $logs_label = $this->entityTypeManager->getStorage('log')->getEntityType()->getCollectionLabel();
$output['log'] = [ $output['log']['label'] = [
'#markup' => '<strong>' . Link::createFromRoute($logs_label, 'view.farm_log.page')->toString() . '</strong>', '#type' => 'html_tag',
'metrics' => [ '#tag' => 'h6',
'#value' => Link::createFromRoute($logs_label, 'view.farm_log.page')->toString(),
];
$output['log']['metrics'] = [
'#type' => 'container', '#type' => 'container',
'#attributes' => [ '#attributes' => [
'class' => 'logs metrics-container', 'class' => 'logs metrics-container',
], ],
],
]; ];
$metrics = $this->getEntityMetrics('log'); $metrics = $this->getEntityMetrics('log');
foreach ($metrics as $metric) { foreach ($metrics as $metric) {