path.install 768 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * @file
  4. * Update functions for the path module.
  5. */
  6. /**
  7. * Change the path field to computed for node and taxonomy_term.
  8. */
  9. function path_update_8200() {
  10. $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  11. foreach (['node', 'taxonomy_term'] as $entity_type_id) {
  12. if ($entity_definition_update_manager->getEntityType($entity_type_id)) {
  13. // Computed field definitions are not tracked by the entity definition
  14. // update manager, so remove them.
  15. $storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('path', $entity_type_id);
  16. if ($storage_definition) {
  17. $entity_definition_update_manager->uninstallFieldStorageDefinition($storage_definition);
  18. }
  19. }
  20. }
  21. }