$elements['#theme'
] = 'file_widget_multiple';
$elements['#theme_wrappers'
] =
['details'
];
$elements['#process'
] =
[[static::
class, 'processMultiple'
]];
$elements['#title'
] =
$title;
$elements['#description'
] =
$description;
$elements['#field_name'
] =
$field_name;
$elements['#language'
] =
$items->
getLangcode();
// The field settings include defaults for the field type. However, this
// widget is a base class for other widgets (e.g., ImageWidget) that may
// act on field types without these expected settings.
$field_settings =
$this->
getFieldSettings() +
['display_field' => NULL
];
$elements['#display_field'
] =
(bool) $field_settings['display_field'
];
// Add some properties that will eventually be added to the file upload
// field. These are added here so that they may be referenced easily
// through a hook_form_alter().
$elements['#file_upload_title'
] =
$this->
t('Add a new file'
);
$elements['#file_upload_description'
] =
[ '#theme' => 'file_upload_help',
'#description' => '',
'#upload_validators' =>
$elements[0
]['#upload_validators'
],
'#cardinality' =>
$cardinality,
];