You are here

protected function ThemeNegotiatorWrapper::getSortedNegotiators in Devel 4.x

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Theme/ThemeNegotiatorWrapper.php \Drupal\webprofiler\Theme\ThemeNegotiatorWrapper::getSortedNegotiators()
  2. 8 webprofiler/src/Theme/ThemeNegotiatorWrapper.php \Drupal\webprofiler\Theme\ThemeNegotiatorWrapper::getSortedNegotiators()
  3. 8.2 webprofiler/src/Theme/ThemeNegotiatorWrapper.php \Drupal\webprofiler\Theme\ThemeNegotiatorWrapper::getSortedNegotiators()

Returns the sorted array of theme negotiators.

@todo Remove this method when we decide to drop Drupal 8.3.x support.

Return value

array|\Drupal\Core\Theme\ThemeNegotiatorInterface[] An array of theme negotiator objects.

1 call to ThemeNegotiatorWrapper::getSortedNegotiators()
ThemeNegotiatorWrapper::determineActiveTheme in webprofiler/src/Theme/ThemeNegotiatorWrapper.php
Determine the active theme for the request.

File

webprofiler/src/Theme/ThemeNegotiatorWrapper.php, line 68

Class

ThemeNegotiatorWrapper
Class ThemeNegotiatorWrapper.

Namespace

Drupal\webprofiler\Theme

Code

protected function getSortedNegotiators() {
  if (!isset($this->sortedNegotiators)) {

    // Sort the negotiators according to priority.
    krsort($this->negotiators);

    // Merge nested negotiators from $this->negotiators into
    // $this->sortedNegotiators.
    $this->sortedNegotiators = [];
    foreach ($this->negotiators as $builders) {
      $this->sortedNegotiators = array_merge($this->sortedNegotiators, $builders);
    }
  }
  return $this->sortedNegotiators;
}