function FieldTypePluginManager::processDefinition

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

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

File

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

Class

FieldTypePluginManager
Plugin manager for 'field type' plugins.

Namespace

Drupal\Core\Field

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);
  if (!isset($definition['list_class'])) {
    $definition['list_class'] = '\\Drupal\\Core\\Field\\FieldItemList';
  }
  if ($definition['category'] instanceof TranslatableMarkup) {
    @trigger_error('Using a translatable string as a category for field type is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3375748', E_USER_DEPRECATED);
    $definition['category'] = FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY;
  }
  elseif (empty($definition['category'])) {
    // Ensure that every field type has a category.
    $definition['category'] = FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY;
  }
}

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