From 97337bd017c8c40f64328755a93e8d98ec77519c Mon Sep 17 00:00:00 2001 From: Sascha Grossenbacher Date: Mon, 25 Jan 2016 00:56:56 +0100 Subject: [PATCH] Issue #2655844 by Berdir: Remove file_entity_entity_base_field_info() --- file_entity.module | 24 ------------------------ src/Tests/FileEntityPathautoTest.php | 7 +++++++ 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/file_entity.module b/file_entity.module index 4e4ddc4..5ef78ab 100644 --- a/file_entity.module +++ b/file_entity.module @@ -304,30 +304,6 @@ function file_entity_file_download($uri) { } /** - * @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',