function file_entity_entity_base_field_info in File Entity (fieldable files) 8.2
Implements hook_entity_base_field_info().
File
- ./
file_entity.module, line 330 - Extends Drupal file entities to be fieldable and viewable.
Code
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)
->setProvider('file_entity')
->setDisplayOptions('form', array(
'type' => 'path',
'weight' => 30,
))
->setDisplayConfigurable('form', TRUE);
return $fields;
}
}