Skip to content
This repository was archived by the owner on Jan 5, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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