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

Breadcrumb

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

function ChoiceFormField::buildOptionValue

Returns option value with associated disabled flag.

2 calls to ChoiceFormField::buildOptionValue()
ChoiceFormField::addChoice in vendor/symfony/dom-crawler/Field/ChoiceFormField.php
Adds a choice to the current ones.
ChoiceFormField::initialize in vendor/symfony/dom-crawler/Field/ChoiceFormField.php
Initializes the form field.

File

vendor/symfony/dom-crawler/Field/ChoiceFormField.php, line 234

Class

ChoiceFormField
ChoiceFormField represents a choice form field.

Namespace

Symfony\Component\DomCrawler\Field

Code

private function buildOptionValue(\DOMElement $node) : array {
    $option = [];
    $defaultDefaultValue = 'select' === $this->node->nodeName ? '' : 'on';
    $defaultValue = isset($node->nodeValue) && $node->nodeValue ? $node->nodeValue : $defaultDefaultValue;
    $option['value'] = $node->hasAttribute('value') ? $node->getAttribute('value') : $defaultValue;
    $option['disabled'] = $node->hasAttribute('disabled');
    return $option;
}

API Navigation

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