function ListStringItem::processAllowedValuesKey
Same name and namespace in other branches
- 10 core/modules/options/src/Plugin/Field/FieldType/ListStringItem.php \Drupal\options\Plugin\Field\FieldType\ListStringItem::processAllowedValuesKey()
Sets the machine name source to be the label.
File
-
core/
modules/ options/ src/ Plugin/ Field/ FieldType/ ListStringItem.php, line 115
Class
- ListStringItem
- Plugin implementation of the 'list_string' field type.
Namespace
Drupal\options\Plugin\Field\FieldTypeCode
public static function processAllowedValuesKey(array &$element) : array {
$parents = $element['#parents'];
array_pop($parents);
$parents[] = 'label';
$element['#machine_name']['source'] = $parents;
// Override the default description which is not applicable to this use of
// the machine name element given that it allows users to manually enter
// characters usually not allowed in machine names.
if (!isset($element['#description'])) {
$element['#description'] = '';
}
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.