public static function ImceFileField::processWidget in IMCE 8
Same name and namespace in other branches
- 8.2 src/ImceFileField.php \Drupal\imce\ImceFileField::processWidget()
Processes widget form.
File
- src/
ImceFileField.php, line 63
Class
- ImceFileField
- Defines methods for integrating Imce into file field widgets.
Namespace
Drupal\imceCode
public static function processWidget($element, FormStateInterface $form_state, $form) {
// Path input.
$element['imce_paths'] = [
'#type' => 'hidden',
'#attributes' => [
'class' => [
'imce-filefield-paths',
],
'data-imce-url' => Url::fromRoute('imce.page', [
'scheme' => $element['#scheme'],
])
->toString(),
],
// Reset value to prevent consistent errors.
'#value' => '',
];
// Library.
$element['#attached']['library'][] = 'imce/drupal.imce.filefield';
// Set the pre-renderer to conditionally disable the elements.
$element['#pre_render'][] = [
get_called_class(),
'preRenderWidget',
];
return $element;
}