You are here

public function UltimenuTool::parseThemeInfo in Ultimenu 8.2

Returns the default theme Ultimenu regions from theme .info.yml.

Parameters

array $ultimenu_regions: The ultimenu theme regions.

Return value

array The Ultimenu regions.

Overrides UltimenuToolInterface::parseThemeInfo

File

src/UltimenuTool.php, line 225

Class

UltimenuTool
Provides Ultimenu utility methods.

Namespace

Drupal\ultimenu

Code

public function parseThemeInfo(array $ultimenu_regions = []) {
  if (!isset($this->themeRegions)) {
    $theme = $this
      ->getThemeDefault();
    $file = drupal_get_path('theme', $theme) . '/' . $theme . '.info.yml';

    // Parse theme .info.yml file.
    $info = $this->infoParser
      ->parse($file);
    $regions = [];
    foreach ($info['regions'] as $key => $region) {
      if (array_key_exists($key, $ultimenu_regions)) {
        $regions[$key] = $region;
      }
    }
    $this->themeRegions = $regions;
  }
  return $this->themeRegions;
}