I am using Drupal 8.4.2. I have created my content type and I have an image field in the form fields.
The image upload field is showing on the page but, the upload button is not showing. If I inspect the element, I can see that
'js-hide' class is added for the upload button. I think that is coming from
processManagedFile() in core/modules/file/src/Element/ManagedFile.php file.
$element['upload_button'] = [ '#name' => $parents_prefix . '_upload_button', '#type' => 'submit', '#value' => t('Upload'), '#attributes' => ['class' => ['js-hide']], // Hide class added from here. '#validate' => , '#submit' => ['file_managed_file_submit'], '#limit_validation_errors' => [$element['#parents']], '#ajax' => $ajax_settings, '#weight' => -5, ];
It means upload button is hidden in Drupal 8 by default, does it.
If so, after selecting an image, the upload should happen automatically. That is also not happening?
What might be the problem? Is there any setting I need to enable? I would like to have either upload button or the image should be uploaded automatically after selecting an image.
I am having this form for administrator users. Any change must be done in theme, in the specific in the Seven theme.
After selecting an image no ajax request is sent. Do I need to configure ajax upload somewhere in the drupal admin? But after submitting the form, image getting uploaded but showing the alert as "Alternative Text" is mandatory(which was not displayed when uploading the image)