function ComponentNegotiator::maybeNegotiateByModule

Same name in this branch
  1. 11.x core/modules/sdc/src/ComponentNegotiator.php \Drupal\sdc\ComponentNegotiator::maybeNegotiateByModule()
Same name in other branches
  1. 10 core/modules/sdc/src/ComponentNegotiator.php \Drupal\sdc\ComponentNegotiator::maybeNegotiateByModule()
  2. 10 core/lib/Drupal/Core/Theme/ComponentNegotiator.php \Drupal\Core\Theme\ComponentNegotiator::maybeNegotiateByModule()

Negotiate the component from the list of candidates for a module.

Parameters

array[] $candidates: The candidate definitions.

Return value

string|null The negotiated plugin ID, or NULL if none found.

1 call to ComponentNegotiator::maybeNegotiateByModule()
ComponentNegotiator::doNegotiate in core/lib/Drupal/Core/Theme/ComponentNegotiator.php
Negotiates the active component for the current request.

File

core/lib/Drupal/Core/Theme/ComponentNegotiator.php, line 132

Class

ComponentNegotiator
Determines which component should be used.

Namespace

Drupal\Core\Theme

Code

private function maybeNegotiateByModule(array $candidates) : ?string {
    foreach ($candidates as $candidate) {
        if ($candidate['extension_type'] === ExtensionType::Module) {
            return $candidate['id'];
        }
    }
    return NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.