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.
Problem/Motivation
Taxonomy term reference field are not currently supported for mapping (see #2563065: Not all field types are supported by mapping).
This could be useful for categorising content, for example linking imported nodes to users.
Proposed resolution
Provide support for taxonomy term fields by looking up their term id.
Remaining tasks
- Detect if field being mapped to is a taxonomy term field
- Lookup term id from text value, and use this as value.
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#11 | social_content-add_taxonomy_term_import_support-2766201.patch | 1.21 KB | iampuma |
Comments
Comment #2
Leon Kessler CreditAttribution: Leon Kessler commentedNot fully understanding what you're trying to do here. Why does your user field need to be a taxonomy term field? Seems like it would be fine to be entity reference field.
Comment #3
ydahiThanks for your question. Yes, I can swap the field to be a entity reference instead of a taxonomy term reference.
I'll try and elaborate on my use case:
So far my approach has been as follows:
That last step is where I'm having problems. I'm also hoping that there is a better way to do this. Any help/guidance would be greatly appreciated.
Comment #4
Leon Kessler CreditAttribution: Leon Kessler commentedIs the issue here that you're not able to map to a taxonomy term reference field? (And that's why you're looking at resorting to options like Rules autotag)?
If that is the case then we can turn this into a feature request and update the summary.
Comment #5
ydahiSure thing, that sounds more accurate.
Updating issue to reflect real purpose. The creation of the view is out of the scope of this issue any way.
Comment #6
ydahiComment #7
Leon Kessler CreditAttribution: Leon Kessler commentedHave updated issue as this should apply to all fields, not just tweet_user.
Also adding related issue that deals with not all field types being supported.
Comment #8
bgrobertson CreditAttribution: bgrobertson commented@ydahi, i was trying to do something similar. Now i'm trying to switch to an entity reference field instead, but I can't seem to get it to work. Can you post your code for how you are creating/saving those fields?
Comment #9
ydahi@bgrobertson, I don't think any code has been written yet - this is still a feature request.
I ended up using the following tools to build the view:
- TT RSS Twitter feeds parser (https://github.com/jdelamater99/Twitter-RSS-Parser)
- Feeds
- Rules Autotag
- Views field Views
I use the the Feeds module to parse the RSS feed built with TTRSS parser. So far this has been working great - even the workflow for adding more hashtags and twitter accounts is easy enough for average users to perform. Hope that helps!
Comment #10
bgrobertson CreditAttribution: bgrobertson commentedI was able to get this to work with entity reference fields, problem is it only seems to work sometimes. I'm using the entity reference module and the entity reference autocomplete module.
Here's my code:
Comment #11
iampumaI created the following patch for mapping hashtags to taxonomy field terms. It works as the following proposal above and in addition creates the term if it does not exist.
This patch has only been tested with Instagram.
Comment #13
Pere OrgaCommitted #11 with the following:
Otherwise it fails when
$value
is a single item.Thanks.