Closed (outdated)
Project:
Inline Entity Form
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Jun 2012 at 21:51 UTC
Updated:
6 Nov 2025 at 23:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
joachim commentedThis was surprisingly easy. Works fine, though throws up error messages because of #1661238: hook_field_is_empty() gets junk data.
Patch is on top of #1659584: support taxonomy term as inline entity, obviously ;)
Comment #2
pjcdawkins commentedI'd really like to see this working. I think it'd make IEF very useful (even for those who don't use Commerce).
Is there any way around the error messages?
Comment #3
bojanz commentedI suggest using the latest -dev of entityreference if you want terms with inline entity form.
Using taxonomy term reference fields gives you no benefits. So this issue is not even in my Top 100 priority wise.
Comment #4
joachim commented> Using taxonomy term reference fields gives you no benefits
Indeed, but it would be nice for existing sites that already have their data in this field type. I do agree with your assessment of the priority though :)
Comment #5
nbchip commentedExcept that using entityreference u dont actually classify node under term, so node is not shown in default term view page
Comment #6
bojanz commented@nbchip
That has been fixed in Entityreference 7.x-1.x-dev as far as I know (might even be in the last release, haven't checked).
Comment #7
bojanz commentedPostponed on #1661238: hook_field_is_empty() gets junk data, if someone provides a patch for that issue, I will commit this one.
Comment #8
vasikehere is a new patch that should provide solution for Taxonomy Term Reference fields.
- reroll the previous patch
- add extra validation for this field type () (mister bojanz suggestion):
tha validation function adds dummy tid values for the form element to avoid taxonomy_field_is_empty() errors.
- new autocomplete function for the "Add existing term" autocomplete form.
imho this issue should be closed/solved (i want to make it major task instead of feature request, but i let mister bojanz to do it) for 2 main reasons:
- Drupal core reference field
- Drupal systems that are already built using this kind of reference and they want to adopt this widget.
p.s. : should we mark the other issue (#1661238: hook_field_is_empty() gets junk data) as duplicate of this?
Comment #9
vasikeupdate the patch: use "dummy" validation for both IEF widgets.
Comment #10
bojanz commentedLooks good!
We can't do $form_state['values'][$element['#field_name']] because the values might be nested further down. You need to do:
drupal_array_get_nested_value($form_state['values'], $element['#parents']) instead;
Comment #11
vasike@bojanz : thank you Sir
here is the patch, drupal_array_get_nested_value()'s way.
Comment #12
vasikenew patch : remove a trailing whitespace.
Comment #13
vasikepatch re-rolled.
Comment #14
k.skarlatos commentedThis patch works for me, but i have the following problem. Non admin users cannot add new taxonomy terms, when there are already existing terms on the term reference field, the create new term button does not show up, only the "add existing term" does. creating new terms works ok with another widget like autocomplete deluxe.
Comment #15
vasike@k.skarlatos : i think this how it should be, it respects the permissions for taxonomies.
So please check your taxonomies permissions.
Comment #16
k.skarlatos commentedMy permissions seem fine, they have edit and delete permission, plus an add taxonomy term permission via Taxonomy access fix
Comment #17
Weaver commentedIt would appear that IEF doesnt currently integrate with Taxonomy Access Fix, if I can get some proof of concept code together is someone interested in looking at it?
Comment #18
Weaver commentedUpdated to work with taxonomy access fix, works in my use case, code is long hand just to make it more readable, what would be needed to get this committed?
Comment #19
Weaver commentedAlso it seems entity_access('delete', $controller->entityType(), $entity) for taxonomies is returning whether the user can delete the vocabulary not the term.
entity_metadata_taxonomy_access (the callback used by entity_access for types of taxonomy_term and taxonomy_vocabulary) is woefully incomplete, have raised an issue at entity API. (https://www.drupal.org/node/2323619)
As a workaround in the meantime you can add an extra check in function inline_entity_form_field_widget_form to test if the current entity is a taxonomy and if it is, if the user has access to edit terms in the entities vocab...
if (empty($entity_id) || $controller->getSetting('allow_existing')
|| entity_access('delete', $controller->entityType(), $entity) ||
($settings['entity_type'] == 'taxonomy_term' && (user_access("delete terms in $entity->vid") || user_access('administer taxonomy')))) {
Circa line 630, your mileage may vary...
Comment #20
joachim commentedI'm not sure it's feasible to support all the modules that fix/improve taxonomy permissions. As well as https://www.drupal.org/project/taxonomy_access_fix, there's https://www.drupal.org/project/vppr, and possibly others.
Support for non-core permissions can be figured out in a follow-up, at least.
Comment #21
Weaver commentedHi Joachim, what would you need to get that patch committed? Or are you saying that you don't want to support contrib modules only core (I would understand if you had concerns about changes to taxonomy_access_fix breaking your module), it would be good to know wether we should just fork IEF or continue to try and get involved with supporting it.
Comment #22
joachim commentedI'm not saying IEF shouldn't support that. What I'm saying is that supporting contrib taxonomy permissions is not as straight-foward as it might seem, and this issue has been going for over a year, so it would be best to focus on getting core support in first, and then figure out contrib support in a follow-on, otherwise we risk this dragging on even longer. The perfect is the enemy of the good :)
Comment #23
Weaver commentedOK thanks for the quick response, you are making perfect sense.
I assume you want to stay with Entity API for testing permissions as you do now so the same code supports different entity types. If so, then I think I've got the core permissions issues covered with this one:
https://www.drupal.org/node/2323619#comment-9066891
Is there any way you can push that issue? Do you know any of the Entity API maintainers?
The way I see it, we get that committed, test and confirm IEF is then behaving as expected with available core permissions, then revisit the above patch to expand it to work with contrib modules.
Comment #24
chris matthews commentedThe 4 year old patch in #18 to inline_entity_form.module applied cleanly to the latest inline_entity_form 7.x-1.x-dev and if still applicable needs review.
Comment #25
firewaller commented+1
Comment #26
bluegeek9 commentedWe appreciate your contributions to Inline Entity Form. Drupal 7 in End-of-Life. We encourage you to upgrade to a supported version of Drupal.