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

Breadcrumb

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

function XmlFileLoader::parseOptions

Parses a collection of "option" XML nodes.

Parameters

\SimpleXMLElement $nodes The XML nodes:

1 call to XmlFileLoader::parseOptions()
XmlFileLoader::parseConstraints in vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php
Parses a collection of "constraint" XML nodes.

File

vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php, line 146

Class

XmlFileLoader
Loads validation metadata from an XML file.

Namespace

Symfony\Component\Validator\Mapping\Loader

Code

protected function parseOptions(\SimpleXMLElement $nodes) : array {
    $options = [];
    foreach ($nodes as $node) {
        if (\count($node) > 0) {
            if (\count($node->value) > 0) {
                $value = $this->parseValues($node->value);
            }
            elseif (\count($node->constraint) > 0) {
                $value = $this->parseConstraints($node->constraint);
            }
            else {
                $value = [];
            }
        }
        else {
            $value = XmlUtils::phpize($node);
            if (\is_string($value)) {
                $value = trim($value);
            }
        }
        $options[(string) $node['name']] = $value;
    }
    return $options;
}

API Navigation

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