summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/navigation/src/NavigationLayout.php
blob: 898bfd3b57ff0a246903ae8c82ae2399ef1bc1f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

declare(strict_types=1);

namespace Drupal\navigation;

use Drupal\Core\Layout\LayoutDefault;
use Drupal\Core\Render\Element;

/**
 * Defines a layout class for navigation.
 *
 * @internal
 */
final class NavigationLayout extends LayoutDefault {

  /**
   * {@inheritdoc}
   */
  public function build(array $regions) {
    foreach (Element::children($regions) as $region_id) {
      foreach (Element::children($regions[$region_id]) as $component_uuid) {
        if (!Element::isEmpty($regions[$region_id][$component_uuid])) {
          $regions[$region_id][$component_uuid]['#theme'] = 'block__navigation';
        }
      }
    }
    return parent::build($regions);
  }

}