Closed (fixed)
Project:
Media Directories
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jan 2020 at 14:30 UTC
Updated:
22 Apr 2020 at 22:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
rang501 commentedIt seems that it has the same issue which was fixed in Add media form, the library location has been changed in 8.8. Currently, the only solution I see is to add two libraries - if the library is missing, it doesn't throw fatal error or exceptions, so it should be good enough until 8.7 is EOL.
Comment #3
rang501 commentedComment #4
ytsurkSo, the seven library makes the image move to the left in a grey backgrounded column.
I also use seven, but claro will replace seven soon :D
Do we really want to force the seven design?
I would prefer to remove the seven libraries everywhere, and maybe only add them if seven is the active theme using
Comment #5
ytsurkComment #6
rang501 commentedThat's a good point, so we either duplicate or create a custom library for this or find a way to include correct library based on active theme. I don't see any media library stuff in Claro, it is either not yet ready or they are not adding any. Need to look how media library looks with Claro theme by default.
Comment #7
ytsurkI think claro will, like seven, support the media library. Thus, we need to make sure the "original" from hooks are invoked.
So, seven hooks in like this:
Comment #8
ytsurkComment #9
ytsurkSeems a bigger issue with visual impact in 8.2.1/2 .. I think we mess with the seven-theme-image-widget .. we need to include different libraries, and use new CSS classes and then decide what we want to include use finally ..
Comment #10
ytsurkComment #11
ytsurkComment #12
ytsurkComment #13
ytsurkComment #14
ytsurkComment #15
ytsurkComment #16
ytsurkComment #17
ytsurkComment #18
ytsurkThis patch unifies now the AddMediaForm and MediaEditForm. Also a new help text was added on the main modules setting page via hook_form_alter.
A new definable form display mode should be probably discussed and handled in another issue.
AddMedia and Editform looks now nice, on 8.7.x 8.8.1 and 8.8.2, in seven, claro, bartik and umami themes and gets now a custom library injected.
Comment #19
ytsurkComment #20
ytsurkSomehow wrong CSS sneaked in the last patch ..
Comment #21
ytsurkHere an improved patch for the AddMediaForm, the last patches did not really make it better ..
Comment #22
rang501 commentedI have reviewed your changes. I see that the add form and edit form are quite different now, I think you made some of the change because remove button didn't work correctly, now fixed in #3118805: AddForm's remove link not working, so we could take a few steps back? Let me explain:
I'm offering this layout as default to use in both add and edit (image widget with alt text and alt/title text):


I do see some issues when the preview is removed - it is harder to know which file you are editing, it is fine when the image is used, but not when editing video. In the end, we have two possibilities - try to re-implement the core solution, or create a simple version, as you can see on the mockups.
Anyway, thank you for all the work! We need to decide what is the best solution :)
Comment #23
ytsurkThanks for your review.
This issue here has nothing to do with the remove link, except it's position (which is set by using display:flex and we do not need to make any adaptions for it).
I removed the preview in the AddForm because (fe. in claro), you can exchange the source fields data, and for images the preview was not updated and I did not want to implement that ...
I like your design proposal. They do not really differ from the current AddForm in the patch, or I don't see the difference?
So, what exactly do you want to roll back now? We can also split and postpone this issue, as I started broaden it ...
To fix the initial issue of the missing styles in the EditForm we just need to add the libraries consequently.
Comment #24
rang501 commentedOk, maybe I did misunderstand something :)
I think I may have not looked deep enough into this issue, I just applied the patch and saw the default manged_file field without the preview on add media form.
The idea in the linked proposed section issue is something we should adapt definitely, it should also solve the issue with claro. I see that is should be already committed to the media_library module and we should take it over to our module as the 1.x duplicates the media_library classes, the commit is visible here https://git.drupalcode.org/project/drupal/commit/c64b32f
We maybe are overthinking here already :)
Comment #25
ytsurkSo, here a patch actually also adding the library for claro. This just came clear to me today ..
Regarding c64b32f: I decided to be able to work with the source field and this new method
hideExtraSourceFieldComponentsshould be respected in the AddMediaForm and inherited to the others. This is not yet in and could be done in #3101860: Cleanup :D [unused and obsolete] code -!-. This issue here for me is a first step in that direction (reworking all the Forms according to media_library's changes) of unifying the MediaEdit and AddMedia form, make it work with all versions of Drupal.Comment #26
rang501 commentedI think I forgot to comment - the #25 didn't work well, unfortunately, so I created a new patch that tries to use core changes instead, it does work well on my project, so you can take a look at it.
Comment #27
ytsurkThanks a lot for your feedback. I got here somehow lost in a form detection pattern.
I took now your approach for hiding the source field (like media_library), and plugged in my optical changes (more decent), and claro support (flex is not properly defined, so the preview image is really small and the delete button can hang over an input element- but I leave that up to claro).
The interdiff is not complete ...
I
So, this is back to you ;)
Comment #28
ytsurkDecided to already hide the source field in the add form.
Comment #29
rang501 commentedNice work! It seems to be working well :)
Comment #30
rang501 commentedI didn't test uploading and editing process, this isn't working anymore. Uploading gives an error: "Image field is required.", editing doesn't do anything anymore.
Comment #31
rang501 commentedI think I got add form working, I guess it is not good idea to hide source field entirely.
Edit form don't work, not sure yet, whats wrong there - it submits something, but Drupal don't accept it because form method isn't called (it should, even when some validation fails).
Comment #32
ytsurkHmm strange - for me it worked all ... Did you test in a special setup?
Hiding the source field is really something I would like to bring in ..
Comment #33
rang501 commentedI have a standard Drupal setup, I just updated my environment (8.8.5) and reinstalled Drupal - still same issue.
My patch will fix uploading functionality - it was not possible to edit alt text (the whole field was hidden and validation failed with message "Image field is required.", screenshot attached) but I don't find why edit doesn't work - it will make the request, but an empty array is returned, no error on logs.
Comment #34
ytsurkI never tested with the combined upload, your not using that?
I will also try a fresh install and give you feedback here.
Comment #35
rang501 commentedI didn't apply combined upload, used the latest version from git and applied your patch to it.
I have separate and clean drupal installation to test (Drupal is installed with standard profile), there is no custom code that could break it somehow. I used image media type to upload.
Comment #36
ytsurkTotally my bad, Sorry!
Your last patch with "enabling" the source field again is the way it needs to be!
I think we got it here :D
Comment #37
ytsurkUps - the MediaEditForm was still not working, as you pointed out .. So here the fix.
Comment #38
rang501 commentedIt seems to be working now, thanks!
I think this conflicts combined upload functionality - if you don't see any issues with this anymore, can you commit this patch? After that, I'll reroll the combined upload patch.
Comment #39
ytsurk