Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When a field_item_collection causes the file usage on the file usage page the field_item_collection title and the url are taken shown. This does not provide any logical infomation and a invalid link. When a field_item_collection causes the usage it's better to show the hostEntity information and link.
Comment | File | Size | Author |
---|---|---|---|
#26 | field-item-collection-hostentity-2774369-26.patch | 1.94 KB | paulvandenburg |
|
Comments
Comment #2
ralphvdhoudt CreditAttribution: ralphvdhoudt at ezCompany commentedComment #3
ralphvdhoudt CreditAttribution: ralphvdhoudt at ezCompany commentedThis patch changes the information on the page to the hostEntity
Comment #4
mvwensen CreditAttribution: mvwensen commentedPatch works for me but because the result array is keyed with the entity id, this should be also inherited by the field_collection_items.
Comment #5
mvwensen CreditAttribution: mvwensen commentedComment #6
paulvandenburg CreditAttribution: paulvandenburg at ezCompany commentedThis patch has introduced a bug when you have multiple field collection usages. The $entity_type gets overwritten to the host entity_type, but for the second field collection item it still uses this overwritten entity_type that now doesn't match the entity at hand.
Comment #7
paulvandenburg CreditAttribution: paulvandenburg at ezCompany commentedThis patch fixes the bug mentioned above by introducing a local entity type variable that can be modified without breaking the higher scope.
Comment #8
paulvandenburg CreditAttribution: paulvandenburg at ezCompany commentedImproved the patch to also support paragraphs_item entities.
Perhaps a hook to discover entities that should use their host entity should be made. For now this solves my problems.
Comment #9
Jérôme DehorterHi,
The patch can't solve a field_collection_item on a unpublished node with workbench, workbench media & workbench moderation module.
Module version :
File Entity : 7.x-2.0-beta3
Workbench : 7.x-1.2
Workbench Media : 7.x-2.1
Workbench Modiration : 7.x-1.4
I create a patch for my client. perhaps it can help you to solve this problem. The patch add node status after the host label and change entity type to add host entity type.
Comment #10
Jérôme DehorterComment #11
joseph.olstad@Jérôme Dehorter,
please fix your patch.
To correctly make a patch for a contrib module you must first clone the contrib module, in this case file_entity.
then make your changes in that cloned module
create your patch from the git diff.
What you submitted in #2774369-9: Change field_collection_item on file usage page to hostEntity
is a patch for YOUR environment, apparently you've created a git repo for your whole stack (and generated a patch from it) and as a consequence your patch will not apply correctly to file_entity.
For more information:
Drupal.org - Making a patch with Git
Comment #12
joseph.olstadComment #13
joseph.olstadI corrected comment #11
clone as follows
Comment #14
Jérôme DehorterHi,
Sorry for that, it's my first contribution and i don't know how to contribute. I do it soon and i push my contribution.
Thx for this quick reply. I hope i can help i little.
Comment #15
Jérôme DehorterHi,
I rework the patch like you ask me. I hope it's work now.
Comment #17
joseph.olstadNice effort Jérôme, you'll have to try again, for now setting back to Patch 8 and needs review.
Comment #18
Jérôme DehorterHi,
I review this quick. How can I test my patch before submit ? Can I download test scripts ?
Comment #19
joseph.olstad@Jérôme, enable the 'Testing' module included with all copies of Drupal 7
then go to
/admin/config/development/testing
scroll to Fieldable Files, add a checkbox , press run test button
Comment #20
Jérôme DehorterHi,
The new patch is here. I don't find 'Fieldable Files' in my Testing module. I hope it's good now.
Comment #22
joseph.olstadFile entity tests might just be classified under 'Files'
not sure, maybe look for 'File Entity' or file_entity tests.
Either way, it's in there, make sure the file_entity module is enabled first ,then check.
Comment #23
joseph.olstadComment #24
paulvandenburg CreditAttribution: paulvandenburg commentedI'm setting this back to needs review. I think with #8 we can already improve this module with a better handling of file usage handling withing item collections. The remarks of Jérôme might be better suited for a follow up issue, if necessary.
We are already using this patch in production of a few dozen sites already in our DvG distribution since this patch was added: #2841653: Fix bug in file_entity file usage when the file is included in multiple field collections. Which I think proves that the patch is solid, but I'll leave it up to someone else to mark it RTBC.
Comment #25
joseph.olstadcannot RTBC until the tests all pass, test case might have to be adjusted , have a look at the test results and the test that is failing.
Comment #26
paulvandenburg CreditAttribution: paulvandenburg commentedRerolled #8 against latest 2.x-dev
Comment #27
joseph.olstadThanks everyone, setting this to RTBC. If this blows up, I'll call @paulvandenburg
Thanks!
Comment #30
joseph.olstad