Drupal 8 Campo de imagem personalizado
//form build
$form['my_file'] = [
'#type' => 'managed_file',
'#title' => 'my file',
'#name' => 'my_custom_file',
'#description' => $this->t('my file description'),
'#default_value' => [$config->get('my_file')],
'#upload_location' => 'public://'
];
//form submit
$form_state->getValue('my_file')[0];
Graceful Gecko