path.post_update.php 711 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * @file
  4. * Post update functions for the path module.
  5. */
  6. use Drupal\Core\Language\LanguageInterface;
  7. use Drupal\language\Entity\ContentLanguageSettings;
  8. /**
  9. * Create the language content settings configuration object for path aliases.
  10. */
  11. function path_post_update_create_language_content_settings() {
  12. $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  13. if ($entity_definition_update_manager->getEntityType('language_content_settings')) {
  14. ContentLanguageSettings::loadByEntityTypeBundle('path_alias', 'path_alias')
  15. ->setDefaultLangcode(LanguageInterface::LANGCODE_NOT_SPECIFIED)
  16. ->setLanguageAlterable(TRUE)
  17. ->trustData()
  18. ->save();
  19. }
  20. }