Same filename and directory in other branches
- 10 core/lib/Drupal/Core/Form/OptGroup.php
- 8.9.x core/lib/Drupal/Core/Form/OptGroup.php
Namespace
Drupal\Core\Form
File
core/lib/Drupal/Core/Form/OptGroup.php
View source
<?php
namespace Drupal\Core\Form;
class OptGroup {
public static function flattenOptions(array $array) {
$options = [];
static::doFlattenOptions($array, $options);
return $options;
}
protected static function doFlattenOptions(array $array, array &$options) {
foreach ($array as $key => $value) {
if (is_object($value) && isset($value->option)) {
static::doFlattenOptions($value->option, $options);
}
elseif (is_array($value)) {
static::doFlattenOptions($value, $options);
}
else {
$options[$key] = $value;
}
}
}
}
Classes
Name |
Description |
OptGroup |
Provides helpers for HTML option groups. |