Problem/Motivation

my question is this: if i create a content type that has a 'media' field (with bundle type 'image'), and then try to use that content type in a Diba Carousel block, the 'Image field' dropdown in 'Slide fields' is empty, ie: it isn't showing my media field.

i then created a standard 'image' field on my content type, and sure enough, that one was visible in the dropdown, and worked as expected.

Steps to reproduce

  • set up a content type with a field of type 'media', subtype/bundle 'image'
  • try binding a Diba Carousel block's "Image field" (ie: should be a field from the entity type to use for each slide) to that media field. you can't! it won't be listed in the dropdown. it looks like only fields of type 'image' are listed.

Proposed resolution

i am still too new to D9 to propose how to fix, but i can get you started in the right direction ;-) in /modules/contrib/diba_carousel/src/Plugin/Block/DibaCarousel.php go to line 397, in version 2.0.0 the code says:

'#options' => $this->getFieldsByType(['image'], $config['entity_selected']),

i actually tried changing this to

'#options' => $this->getFieldsByType(['media'], $config['entity_selected']),

or

'#options' => $this->getFieldsByType(['media.type.image'], $config['entity_selected']),

and neither of those made any difference, the dropdown was still empty.

i assume there are some other complications at work here? it's over my head.

Comments

goatvirus created an issue. See original summary.

earthangelconsulting’s picture

Issue summary: View changes
oriol_e9g’s picture

Version: 2.0.0 » 2.0.x-dev
Assigned: Unassigned » oriol_e9g
Category: Bug report » Feature request
Status: Active » Needs work

Supporting media images is a feature request that has not yet been developed. Maybe I will probably develop it in a few months.

earthangelconsulting’s picture

that's awesome, oriol_eg9, i am glad to hear that it's on the list !

this is a great module, by the way :-) :-) absolutely does the trick!

oriol_e9g’s picture

Title: does 'Image field' in 'Slide fields' support media types too? » Does 'Image field' in 'Slide fields' support media types too?
Version: 2.0.x-dev » 3.x-dev

  • oriol_e9g committed 73213554 on 3.x
    feat: #3271763 Does 'Image field' in 'Slide fields' support media types...
oriol_e9g’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.