Problem/Motivation
Operations "edit" and "remove" are only available for nodes in edit form (not available for user or taxonomy).
Scenario :
- Create a field collection field on user or taxonomy
- Add a field in this new field collection
- Create a user or taxonomy term with a field collection item, operations "edit" and "remove" will be displayed
- Save the user or the taxonomy term
- Edit it, operations will not be displayed (only works with node)
The problem seems to come from the checkAccess() in FieldCollectionItemAccessControlHandler, which try to retrieve the host entity and check the access.
For User or Term, it doesn't work because FieldCollectionItem getHostId() check non existing table for field (ex: taxonomy_term_data_test instead of taxonomy_term__field_test).
Proposed resolution
Fix the table name construction to make it works with other entities than node.
Comment | File | Size | Author |
---|---|---|---|
#5 | operations-edit-and-remove-are-not-available-in-edit-form-2688497-5.patch | 1.26 KB | ademarco |
Comments
Comment #2
jeanfei CreditAttribution: jeanfei commentedHere the patch working for me :
- drupal-8.0.5
- field_collection-8.x-2.x-dev
- inline_entity_form-8.x-1.0-alpha5
Comment #3
Blanca.Esqueda CreditAttribution: Blanca.Esqueda as a volunteer and at Portage CyberTech commentedSame issue.
But now in Drupal 8.1 not even the add field collection item is available.
Comment #4
Blanca.Esqueda CreditAttribution: Blanca.Esqueda as a volunteer and at Portage CyberTech commentedHI,
Applied the patch and it is working for Drupal 8.05 and Drupal 8.1
Thank you @jeanfei
Comment #5
ademarco CreditAttribution: ademarco at Nuvole commentedI've re-rolled patch at #2 by solving the @todo in the same method where the patch was applied.
Comment #6
bircherComment #7
vasyl.kletsko CreditAttribution: vasyl.kletsko commentedApplied this patch in Drupal 8.1.3 and it`s working
Comment #8
jmuzz CreditAttribution: jmuzz commented8.x-2.x is no longer being developed or supported.
Comment #9
woprrr CreditAttribution: woprrr as a volunteer commentedJust one think...
You should use directly helper (standard) specific method $entity_info->id(); to get identifer.
Instead of these $table you should use https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%... is more safe.