public ContentTranslationUpdatesManager::updateDefinitions(array $entity_types)
Executes field storage definition updates if needed.
Parameters
array $entity_types: A list of entity type definitions to be processed.
File
- core/modules/content_translation/src/ContentTranslationUpdatesManager.php, line 52
Class
- ContentTranslationUpdatesManager
- Provides the logic needed to update field storage definitions when needed.
Namespace
Drupal\content_translation
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public function updateDefinitions( array $entity_types ) { // Handle field storage definition creation, if needed. // @todo Generalize this code in https://www.drupal.org/node/2346013. // @todo Handle initial values in https://www.drupal.org/node/2346019. if ( $this ->updateManager->needsUpdates()) { foreach ( $entity_types as $entity_type_id => $entity_type ) { $storage_definitions = $this ->entityManager->getFieldStorageDefinitions( $entity_type_id ); $installed_storage_definitions = $this ->entityManager->getLastInstalledFieldStorageDefinitions( $entity_type_id ); foreach ( array_diff_key ( $storage_definitions , $installed_storage_definitions ) as $storage_definition ) { /** @var $storage_definition \Drupal\Core\Field\FieldStorageDefinitionInterface */ if ( $storage_definition ->getProvider() == 'content_translation' ) { $this ->updateManager->installFieldStorageDefinition( $storage_definition ->getName(), $entity_type_id , 'content_translation' , $storage_definition ); } } } } } |
Please login to continue.