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.
First and foremost, thank you for your work, awesome module. I have more of a question than anything else.
But is there a reason that Taxonomy index is force enabled when an Entity reference field is referencing a taxonomy term?
Is this a global setting of some sort and setting it for one field would set it for all Entity reference fields that reference a taxonomy term? If that's the case, why show a disabled checkbox, I just don't get it.
I think having this ability would be very useful if you wanted a node to reference a term but not necessarily belong to it.
Thanks,
Vlad
Comment | File | Size | Author |
---|---|---|---|
#7 | entityreference-taxonomy_index_force_enabled-1990088-7.patch | 2.72 KB | yuraosn |
#3 | Selection_051.png | 6.9 KB | weemondo |
#3 | entityreference-taxonomy_index_force_enabled-1990088-3.patch | 647 bytes | weemondo |
Comments
Comment #1
weemondo CreditAttribution: weemondo commentedWith respect, I would like to bump this issue. Can someone confirm if it is disabled on purpose? Is there is some reason for the time being that we should refrain from using this option?
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedI'm not sure what you are asking. Could you try to clarify your question?
Could you post more details about your set up, and/or screenshots about what doesn't work as you expect it to?
Comment #3
weemondo CreditAttribution: weemondo commentedThe core entity reference module includes a behavior "Taxonomy Index" which applies when referencing taxonomies. This behaviour will create a corresponding term reference for every entity reference created. In the field settings, the checkbox to enable/disable the behaviour plugin contains the option: force_enabled = TRUE. (see file: /plugins/behavior/taxonomy-index.inc)
Therefore, without editing the module's source it is impossible to create an entity reference to a taxonomy term without also creating a taxonomy term reference also.
Comment #4
Marco Vervoort CreditAttribution: Marco Vervoort commentedI ran into this same issue.
Looking at the issue that created this setting the 'force enabled' flag was intended to make entity-references to taxonomy-terms behave like core references to taxonoym-terms (i.e. items with references are always included in the taxonomy-index for that term) out of the box.
However, the current approach makes the 'taxonomy index' checkbox in the field settings pointless: it is always going to be checked, and is disabled so that it cannot be unchecked. It would be much better if the 'taxonomy index' checkbox was checked by default, but could be unchecked manually.
Patch #3 makes the 'taxonomy index' checkbox functional, but it is unchecked by default. Also, I noticed that if you check or uncheck the checkbox, existing nodes will not be retroactively added or removed from the index (and in the latter case, existing nodes that are already in a taxonomy index for a term will remain in the index for that term, even if you edit the node and select a different taxonomy-term). So as it is, the checkbox is "use with care" when you enable it (possibly this is why it was left disabled in the first place).
Comment #5
ParisLiakos CreditAttribution: ParisLiakos commentedWithout applying the patch, i run this:
Which, disables the behavior, which is also reflected in the field settings page..
But the index is still created on node save :/
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commentedi see now..
EntityReferenceBehavior_TaxonomyIndex::buildNodeIndex()
doesn't care for specific field settings.
Even if just one field has the behavior on, this function will add index for every taxonomy_term field on the node..which is unfortunate..also a bug imo
Comment #7
yuraosn CreditAttribution: yuraosn as a volunteer and commentedThanks for patch #3, but it's not complete.
I made the setting in the admin panel to be viewed and the index was not written.