public function FieldTypePluginManager::getUiDefinitions in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Field/FieldTypePluginManager.php \Drupal\Core\Field\FieldTypePluginManager::getUiDefinitions()
Gets the definition of all field types that can be added via UI.
Return value
array An array of field type definitions.
Overrides FieldTypePluginManagerInterface::getUiDefinitions
File
- core/
lib/ Drupal/ Core/ Field/ FieldTypePluginManager.php, line 127
Class
- FieldTypePluginManager
- Plugin manager for 'field type' plugins.
Namespace
Drupal\Core\FieldCode
public function getUiDefinitions() {
$definitions = $this
->getDefinitions();
// Filter out definitions that can not be configured in Field UI.
$definitions = array_filter($definitions, function ($definition) {
return empty($definition['no_ui']);
});
// Add preconfigured definitions.
foreach ($definitions as $id => $definition) {
if (is_subclass_of($definition['class'], '\\Drupal\\Core\\Field\\PreconfiguredFieldUiOptionsInterface')) {
foreach ($this
->getPreconfiguredOptions($definition['id']) as $key => $option) {
$definitions['field_ui:' . $id . ':' . $key] = [
'label' => $option['label'],
] + $definition;
if (isset($option['category'])) {
$definitions['field_ui:' . $id . ':' . $key]['category'] = $option['category'];
}
}
}
}
return $definitions;
}