function FieldTypePluginManager::getUiDefinitions

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

Overrides FieldTypePluginManagerInterface::getUiDefinitions

File

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

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] = [
                    'label' => $option['label'],
                ] + $definition;
                if (isset($option['category'])) {
                    $definitions['field_ui:' . $id . ':' . $key]['category'] = $option['category'];
                }
            }
        }
    }
    return $definitions;
}

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