- Issue created by @imclean
- π¦πΊAustralia imclean Tasmania
imclean β changed the visibility of the branch 3422506-support-media-library-modify to hidden.
- Status changed to Needs review
over 1 year ago 10:29pm 19 February 2024 - π¦πΊAustralia imclean Tasmania
This works fine as a normal field formatter.
Using Field block β the
target_bundlesis missing (and possibly other field config settings).I can't tell which of the 3 modules is responsible.
- π¦πΊAustralia imclean Tasmania
Fieldblock might be the problem. In its file
src/Plugin/Block/FieldBlock.phpthere's a comment forgetFieldDefinition():* A FieldBlock works on an entity type across bundles, and thus only has * access to field storage definitions. In order to be able to use formatters, * we create a generic field definition out of that storage definition.I think both the entity type and bundle are required to get additional config settings via
entityFieldManager->getFieldDefinitions(). - πΊπ¦Ukraine vlad.dancer Kyiv
If you want to modify photoswipe formatter then you locked by #3301760.
- Status changed to Needs work
about 1 year ago 10:17am 20 August 2024 - π©πͺGermany Anybody Porta Westfalica
I really dislike adding contrib module specific code. Any better approaches?
- π¦πΊAustralia imclean Tasmania
I was following the existing pattern but yeah, I tend to agree.
It might be better to rewrite it to check for
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItemusingis_a()or similar. Or if it implementsDrupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItemInterface. But this might be tricky to do in annotations. - π¦πΊAustralia imclean Tasmania
I've added a few questions to the MR. Given the related issue is stalled, what can be done here?