Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
Issue #2655844 by Berdir: Remove file_entity_entity_base_field_info()
Browse files Browse the repository at this point in the history
  • Loading branch information
Berdir committed Jun 22, 2016
1 parent 9f7799d commit 97337bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
24 changes: 0 additions & 24 deletions file_entity.module
Original file line number Diff line number Diff line change
Expand Up @@ -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".
*/
Expand Down
7 changes: 7 additions & 0 deletions src/Tests/FileEntityPathautoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 97337bd

Please sign in to comment.