Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294882

Add tests to prove that the media library widget works when target_bundles is NULL

$
0
0

Problem/Motivation

@amateescu reported a bug with the media library field widget in #2988617: Creating media with the media library upload is broken for unlimited cardinality:

I think it's worth noting that the target_bundles setting of the ER field has three states:

- NULL: all bundles are referenceable
- []: no bundle is referenceable
- ['some_bundle']: only some_bundle is referenceable

This is documented in \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::defaultConfiguration, and maybe some logic of this patch needs to be updated based on this information.

In practice, target_bundles can only be NULL if a user has not configured their field, since it's a required field (see \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::buildConfigurationForm). Either way, the widget and upload form don't handle this case but probably should.

Proposed resolution

Handle the NULL case for target_bundles and allow all types.

Remaining tasks

Write a patch.

User interface changes

None.

API changes

None.

Data model changes

None.


Viewing all articles
Browse latest Browse all 294882

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>