With Media Entity module OOTB, there are no configured view modes. The select widgets for entity browser show as empty. This is incorrect, as the core entity system always provides a 'default' view mode.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2806693-7.entity_browser.missing-view-mode.patch | 874 bytes | joachim |
Comments
Comment #2
slashrsm commentedI am not sure what "select widgets" refers to. Could you elaborate?
Comment #3
joachim commentedWhen I configure an entity reference field to use the Entity Browser widget, there is a section ' Entity display plugin configuration '. This has a dropdown for the view mode.
Looks like it's this code:
I wonder why getViewModes() isn't providing the default view mode?
(Lastly, I really don't understand why you're categorizing this as a task and not a bug. One of the view modes that I can configure in the entity UI is missing in the dropdown. How is that not something that's broken?)
Comment #4
gausarts commentedProbably a miss? There is a method ::getViewModeOptions() for the select options, so the options part can just use:
$options = $this->entityDisplayRepository->getViewModeOptions($this->configuration['entity_type']);It should reveal the mentioned default view mode.
Comment #5
slashrsm commentedSolution that @gausarts proposed in #4 seems to be the way to go. Thank you for pointing that out.
Comment #6
berdirCore is actually inconsistent here.
default is not a view mode, it is a view display that is the fallback if a view mode is used that doesn't exist. \Drupal\Core\Entity\EntityViewBuilder::view() defaults to full, not default.
Being able to select and use default in the UI results in a lot of confusion actually.
Comment #7
joachim commentedHere's a patch.
Comment #8
samuel.mortensonLooks good to me.
Comment #9
esolitosPatch from #7 seems to be the right approach, also I can confirm that it fixes the issue.
Comment #11
slashrsm commentedCommitted. Thanks!
Comment #13
aminshamim commented#7 ; Its not working for me. Applied the patch but still view mood is not present in the form.