diff --git a/file_entity.module b/file_entity.module index 4e4ddc4..5ef78ab 100644 --- a/file_entity.module +++ b/file_entity.module @@ -303,30 +303,6 @@ function file_entity_file_download($uri) { return -1; } -/** - * @name pathauto_file Pathauto integration for the core file module. - * @{ - */ - -// @todo move -function file_entity_entity_base_field_info(EntityTypeInterface $entity_type) { - // @todo: Make this configurable and/or remove if - // https://drupal.org/node/476294 is resolved. - if (\Drupal::moduleHandler()->moduleExists('pathauto') && $entity_type->id() == 'file') { - $fields = array(); - $fields['path'] = BaseFieldDefinition::create('path') - ->setCustomStorage(TRUE) - ->setLabel(t('URL alias')) - ->setTranslatable(TRUE) - ->setDisplayOptions('form', array( - 'type' => 'path', - 'weight' => 30, - )) - ->setDisplayConfigurable('form', TRUE); - return $fields; - } -} - /** * @} End of "name pathauto_file". */ diff --git a/src/Tests/FileEntityPathautoTest.php b/src/Tests/FileEntityPathautoTest.php index 851819a..bef371f 100644 --- a/src/Tests/FileEntityPathautoTest.php +++ b/src/Tests/FileEntityPathautoTest.php @@ -29,6 +29,13 @@ class FileEntityPathautoTest extends FileEntityTestBase { * Tests Pathauto support. */ public function testPathauto() { + $this->config('pathauto.settings') + ->set('entity_types.file', TRUE) + ->save(); + + \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); + \Drupal::service('plugin.manager.alias_type')->clearCachedDefinitions(); + $pattern = PathautoPattern::create([ 'id' => Unicode::strtolower($this->randomMachineName()), 'type' => 'canonical_entities:file',