function FieldTypePluginManager::getUiDefinitions

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/FieldTypePluginManager.php \Drupal\Core\Field\FieldTypePluginManager::getUiDefinitions()
  2. 8.9.x core/lib/Drupal/Core/Field/FieldTypePluginManager.php \Drupal\Core\Field\FieldTypePluginManager::getUiDefinitions()
  3. 10 core/lib/Drupal/Core/Field/FieldTypePluginManager.php \Drupal\Core\Field\FieldTypePluginManager::getUiDefinitions()

Overrides FieldTypePluginManagerInterface::getUiDefinitions

1 call to FieldTypePluginManager::getUiDefinitions()
FieldTypePluginManager::getEntityTypeUiDefinitions in core/lib/Drupal/Core/Field/FieldTypePluginManager.php
Get the field type definitions that can be added via UI for an entity type.

File

core/lib/Drupal/Core/Field/FieldTypePluginManager.php, line 203

Class

FieldTypePluginManager
Plugin manager for 'field type' plugins.

Namespace

Drupal\Core\Field

Code

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}"] = array_intersect_key($option, [
                    'label' => 0,
                    'category' => 1,
                    'weight' => 1,
                    'description' => 0,
                ]) + $definition;
            }
        }
    }
    return $definitions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.