Last active
February 21, 2021 13:53
-
-
Save JeromeChevalier/8da086f2320a5d2f7860f7edb2ad51ce to your computer and use it in GitHub Desktop.
Create a entity basefield as with a file type #drupal8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fields['download_file'] = BaseFieldDefinition::create('file') | |
->setLabel(t('Forecast data')) | |
->setSetting('file_directory', 'forecast') | |
->setSetting('max_filesize', '10MB') | |
->setSetting('file_extensions', 'csv') | |
->setSetting('description_field', FALSE) | |
->setDisplayOptions('form', [ | |
'label' => 'hidden', | |
'type' => 'file_generic', | |
'weight' => 4, | |
]) | |
->setDisplayConfigurable('form', TRUE) | |
->setDisplayConfigurable('view', TRUE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment