Skip to content
Snippets Groups Projects

Issue #3505182: Avoid rendering a label in the top bar if its NULL

Open m4olivei requested to merge issue/drupal-3505182:3505182-an-entity-without into 11.x
1 file
+ 16
14
Compare changes
  • Side-by-side
  • Inline
@@ -85,21 +85,23 @@ public function build(): array {
return $build;
}
$build += [
[
'#type' => 'component',
'#component' => 'navigation:title',
'#props' => [
'icon' => 'database',
'html_tag' => 'span',
'modifiers' => ['ellipsis', 'xs'],
'extra_classes' => ['top-bar__title'],
],
'#slots' => [
'content' => $entity->label(),
if ($label = $entity->label()) {
$build += [
[
'#type' => 'component',
'#component' => 'navigation:title',
'#props' => [
'icon' => 'database',
'html_tag' => 'span',
'modifiers' => ['ellipsis', 'xs'],
'extra_classes' => ['top-bar__title'],
],
'#slots' => [
'content' => $label,
],
],
],
];
];
}
if ($label = $this->getBadgeLabel($entity)) {
$build += [
Loading