I am configuring a document media bundle.

However, because there's a file field, the crop configuration form element is showing. That's fine, but the select form element forces a field to be chosen because there is no '- None -' option.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

joachim’s picture

woprrr’s picture

hii @joachim,

Sorry but i cannot reproduce your problems, If i need to create an image/file bundle with media my Crop Configuration area have two different states.

Your case i think :
Case 1 : If i create my bundle and not define any fields on my media_bundle. That display the message "There are no file or image fields on this bundle at the moment. In order to configure crop add at least one such field and come back." because we have any field that case do not display an select field (to unsure not block users with validation).

Case 2 : You have created an field type file or image and then this is automaticaly identify by Crop Configuration area and select it.

I don't have any case blocking me in my tests, can you precise your reproduction path ? or precise real problem actualy all cases seems cover.

Otherwise i think with your patch we have a problem because whenever $options are empty we don't pass in this element. Or we are not really blocked by error or whatever other but you are confused by automatic selection by code, and you have an field but you don't need to be select in crop configuration ? (probably i think this is it but prefer confirm with you :))

If is that last suposition i think that is related to #2809121: [meta] source field in type provider is missing a 'None' option and your patch works Good ;) ! @slashrsm i think we need to choose an direction about this subject.

Thank a lot for your feedback.

slashrsm’s picture

Issue tags: +D8Media

Yes, it would be great to see steps to reproduce this.

joachim’s picture

I'm not currently working on the project I was on when I found this, so this is from memory:

1. create a new media bundle. The intention was that it was for document files, eg, PDFs.
2. create a filefield on this bundle
3. the crop module thinks that the filefield might be an image, and so the crop options get shown (in the media bundle settings maybe? I don't remember). Because there is no 'none' option, the filefield is preselected in the form, and I am compelled to set the filefield in the crop settings.

woprrr’s picture

@joachim i admin i didn't say why this third-party setting appear in this configuration, it's not used infact (in basic cases...). I understand your problem your are not "blocked" but you are desapointed to do choose an field not used for crop (file pdf) and you need to set correctly your media bundle settings.

Two ways possible :

1/ Your patch it work good, but other module provide media bundle third party settings not add this "no option" i prefer prevent it on media bundle basis form (if possible) that can be more complex but uniformized with all media bundle.

2/ Or just delete 'file' type in $allowed format because crop are just used in image context...

woprrr’s picture

Status: Needs review » Postponed (maintainer needs more info)
joachim’s picture

I'm sorry, I don't really understand the question.

woprrr’s picture

I just conclude the better way to solve that is on media_entity and not crop api. That option does prevent onto media_entity basis, it's not role of image to provide these option. You have already backported this subject we can close that now ?

#2809121: [meta] source field in type provider is missing a 'None' option

woprrr’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
519 bytes

Here the patch to fix it to still consistence of UI and respect MediaTypeForm/MediaBundleForm wording. This patch is only available for 1.x branch. Lot of changes will come from https://www.drupal.org/node/2918441#comment-12313674 for 1.x branch.

If that's ok can we witch that fast RTBC to merge it and continue to solve all subjects.

joachim’s picture

Eyeball review only, but looks good to me.

woprrr’s picture

Status: Needs review » Reviewed & tested by the community

Nice ! @joachim I have re-tested again and all works as excepted :) Go to merge it into 1.x =====> \o\ \O/ /o/

  • woprrr committed d6a0c5e on 8.x-1.x
    Issue #2808719 by joachim, woprrr, slashrsm: Media bundle crop config...
woprrr’s picture

Status: Reviewed & tested by the community » Fixed

Merged Thanks all :) good job.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.