Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. XmlFileLoader.php

function XmlFileLoader::parseDefaultsConfig

Parses the "default" elements.

1 call to XmlFileLoader::parseDefaultsConfig()
XmlFileLoader::parseConfigs in vendor/symfony/routing/Loader/XmlFileLoader.php
Parses the config elements (default, requirement, option).

File

vendor/symfony/routing/Loader/XmlFileLoader.php, line 333

Class

XmlFileLoader
XmlFileLoader loads XML routing files.

Namespace

Symfony\Component\Routing\Loader

Code

private function parseDefaultsConfig(\DOMElement $element, string $path) : array|bool|float|int|string|null {
    if ($this->isElementValueNull($element)) {
        return null;
    }
    // Check for existing element nodes in the default element. There can
    // only be a single element inside a default element. So this element
    // (if one was found) can safely be returned.
    foreach ($element->childNodes as $child) {
        if (!$child instanceof \DOMElement) {
            continue;
        }
        if (self::NAMESPACE_URI !== $child->namespaceURI) {
            continue;
        }
        return $this->parseDefaultNode($child, $path);
    }
    // If the default element doesn't contain a nested "bool", "int", "float",
    // "string", "list", or "map" element, the element contents will be treated
    // as the string value of the associated default option.
    return trim($element->textContent);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal