$defaults =
[ 'fids' =>
[],
'display' =>
(bool) $field_settings['display_default'
],
'description' => '',
];
// Essentially we use the managed_file type, extended with some
// enhancements.
$element_info =
$this->elementInfo->
getInfo('managed_file'
);
$element +=
[ '#type' => 'managed_file',
'#upload_location' =>
$items[$delta]->
getUploadLocation(),
'#upload_validators' =>
$items[$delta]->
getUploadValidators(),
'#value_callback' =>
[static::
class, 'value'
],
'#process' =>
array_merge($element_info['#process'
],
[[static::
class, 'process'
]]),
'#progress_indicator' =>
$this->
getSetting('progress_indicator'
),
// Allows this field to return an array instead of a single value.
'#extended' => TRUE,
// Add properties needed by value() and process() methods.
'#field_name' =>
$this->fieldDefinition->
getName(),
'#entity_type' =>
$items->
getEntity()->
getEntityTypeId(),
'#display_field' =>
(bool) $field_settings['display_field'
],
'#display_default' =>
$field_settings['display_default'
],