Questions tagged [taxonomy-terms]
"Taxonomy" refers to Drupal's content classification mechanism, organised into vocabularies and terms.
3,619
questions
0
votes
0
answers
19
views
Report comments / Workflow
I am trying to implement a functionality that would allow authenticated users to report comments on a forum post. My first thought was to do it using workflows but comments dont have a workflow ...
-2
votes
0
answers
20
views
How can I preprocess taxonomy terms by their vocabulary? [closed]
/**
* Implements hook_preprocess_taxonomy_term().
*/
function my_drupal_preprocess_taxonomy_term(&$variables) {
// Get the vocabulary ID for the current term.
$vid = $variables['elements']['#...
0
votes
0
answers
14
views
Save multiple taxonomy terms in migration from array of tids
I'm having some issues with storing multiple taxonomy terms in a field as part of a migration.
I've created a custom plugin get_colors that returns an array of existing tids. A custom process plugin ...
0
votes
0
answers
20
views
How to show content / blocks in views for path component 3, 2 OR 1?
The taxonomy contains mostly 3 levels, sometimes two levels only.
Parent
Child 1
Grandchild 1
Child 2
Via path alias, the patterns create URLs like:
/parent/child1/grandchild1
/parent/child2
...
0
votes
1
answer
18
views
Auto assign term to node from term field from user
I have a term field called "Organization" on both Content and User entities.
On the Content entity, the field for Organization is hidden.
For the user, they select a value for Organization.
...
0
votes
1
answer
26
views
Get taxonomy and check if published?
I am trying to display taxonomy programitcally.
The problem is, all taxonomy is displayed whther published all not. How can I filter only published taxonomy.
I use this code to get taxonomy.
$tree = \...
1
vote
0
answers
23
views
Vocabularies are not showing [closed]
In a Drupal 10 installation with PHP 8.2.1 with the module Taxonomy Manager, the vocabularies are not showing up in admin/structure/taxonomy_manager/voc/{categories}
This is probably a JS issue, as ...
0
votes
0
answers
17
views
Use exposed filter "Has taxonomy term (with depth)" for a specific field and not the all the content
My content type has 2 fields related to the same hierarchical taxonomy.
How can I expose a view filter that allows a search "with depth" on only one of these fields and not on all the ...
0
votes
0
answers
14
views
Show List of Custom Blocks with same referenced term as the term on it's term landing page
I have a term which itself has a reference field for taxonomy terms. On the term's landing page, I would like to include a view (block), that shows custom blocks with the same referenced term (I did ...
0
votes
0
answers
24
views
How to render a Taxonomy Term in twig without the term name?
For some reason, I am writing my own controller that needs to include a taxonomy term.
I want to render everything of a taxonomy term (except the name / title) in the template I wrote.
My controller ...
1
vote
1
answer
34
views
Sort nodes by weight of taxonomy term attached to field
In a query for nodes I'm trying to sort the nodes by the weight of a taxonomy term attached to one of the node fields.
Here is how my query is built
$node_storage = \Drupal::entityTypeManager()
...
1
vote
0
answers
22
views
How can I find all the nodes that use a hierarchical vocabulary taxonomy term and reference a child term but not its parent term
I am using Drupal 7.
I have a content type "Public Resource" that uses a hierarchical vocabulary called "Resource Topics" that has up to 3 levels (parent->child->child of ...
1
vote
1
answer
137
views
How to retrieve all taxonomy term using json api
I want to retrieve all taxonomy term name using json api.
I have tried:
http://local-tes/jsonapi/taxonomy_term/specialties
but its only return 50 values, I want to fetch all taxonomy terms values.
1
vote
1
answer
28
views
Avoid group of revisions history view duplication
My taxonomy View lists all revisions grouping by different columns, by adding revision fields for each value, and get the filter "published" removed.
The only filter is: city name (not null)....
0
votes
0
answers
22
views
Views: How to filter content by taxonomy terms that are not selected?
I have a view of a specific content type that can be filtered by two different taxonomies A and B. Some nodes that have the taxonomy term A1 also have the term B5. Now when I filter only by the term ...
1
vote
1
answer
63
views
How can I add term's vocabulary name as body class?
I already had following codes added, which adds term ID as body class. However, how can I change the ID to term's vocabulary name?
For example:
<body class="term-type-cameras">
/**
*...
1
vote
0
answers
92
views
How do I add a query condition to the QueryPluginBase in hook_views_query_alter()?
Using hook_views_query_alter() for a view configured as a REST feed, I'm attempting to add an additional filter value to the query, based on the presence of multiple filters passed via the URL.
I need ...
0
votes
1
answer
35
views
Sub category wrongly classified to root level and cannot be rectified
I am using SHS (Simple hierarchical select) which allows the user to create the child term under the parent term by themselves. For example:
root
--Canon (parent level)
----5D3 (child level)
When I ...
1
vote
1
answer
33
views
Create vocabularies with the JSON API
I found this identical question but it seems to be dead and none of the answers help me. I also don't have enough reputation to ask in a comment, so, since I'm at the end of my rope with this issue, I'...
0
votes
1
answer
32
views
How can I show child categories in the parent category page?
I have created a new vocabulary with some extra fields and these taxonomy terms.
Parent 1
Child 1.1
Child 1.2
Child 1.3
Parent 2
Child 2.1
Child 2.2
Child 2.3
Parent 3
Parent 4
Parent 5
In the ...
0
votes
0
answers
28
views
Articles are displayed multiple times
I have two taxonomies (category, with subcategories, and tags) and a content type (article). An article can be in exactly one (sub-)category but can have multiple tags.
I'm trying to create a view ...
0
votes
1
answer
24
views
How to differentiate the state when a contextual filter is applied?
Hello to all the Drupal community. I've recently faced a challenge to visually modify some parts of my view's template for the state when its contextual filter is applied. Some details are as follows:
...
0
votes
1
answer
28
views
Sort views by number of related tags
I want to create a view block with related content based on shared terms. For this I created a term reference field inside the content type and created a views where I use a contextual filter Taxonomy ...
0
votes
0
answers
20
views
Get all taxonomy terms from one vocabulary used by articles with a term in another vocabulary?
15+ years Joomla user but Drupal newbie here. Taxonomies are causing me a little bit of a headache. For my articles I have set up 2 taxonomy vocabularies: Category and Tags. Each article can (must) ...
0
votes
1
answer
32
views
How do I get the value of the Taxonomy Term Description after loading Taxonomy Vocabulary term by Term ID?
What would be the best way to render the Taxonomy Vocabulary Term description value? I can render the term id and label/title, but the description seems to need something else that I'm not quite ...
0
votes
0
answers
36
views
Filter taxonomy admin overview
I want to programmatically filter the taxonomy overview page for admins. I tried doing this with hook_form_taxonomy_overview_terms_alter and even though the filter is working (the user only can see ...
0
votes
0
answers
17
views
change taxonomies link [duplicate]
I have a problem and I want to modify the link of a taxonomy but I don't know how.
For example, I want that when I click on the taxonomy "news" it takes me to the url "magazine/...
-1
votes
1
answer
91
views
Why is node save extremely slow with two or more tags after migrating tags and restoring from backup?
The problem
Saving a node with one tag saves normally. With two or more, the save takes upwards of 40 seconds.
The problem only occurs after migrating in a set of tags from csv, then creating a ...
-1
votes
2
answers
92
views
Creating a category page when using the Search API module
I’m trying to build a Drupal Commerce store which is going to be my first timer with Drupal 8+. However, the approach described in the Drupal Commerce documentation regarding the creation of a ...
0
votes
0
answers
42
views
View displaying content revision with a relation to a user field
I have a following use case for building a view in D9 that is causing me problems.
Each user has a custom field that refers a taxonomy. Let's say it's a list of departments users belong to. Each user ...
-1
votes
1
answer
77
views
Create Vocabularies and Terms with the JSON:API module
I am using the JSON:API module.
I need to create vocabularies and terms through the endpoint, but it is only accepting GET requests.
Am I using the wrong route or endpoint?
0
votes
1
answer
16
views
Distinct selection of a field in views
I created a view in the views module which displays the blogs posted on my site having ONE tag. (Each blog has only 1 tag)
Is it possible to do a 'distinct' argument to only display every tag in this ...
1
vote
0
answers
34
views
How do I use specific css to taxonomy-term in teaser?
On the front page a list of teasers is shown for different content types. For one of these content types I want to use different css depending on the value of the taxonomy term.
Content type name : &...
0
votes
0
answers
28
views
same view, same url path, identical content, but different categories
Not sure if this is a bug or not, but it's giving me a headache already.
When I add new content on my D7 website, an article in this case I'm facing a strange behavior. Each article has its own "...
0
votes
0
answers
20
views
Define a custom taxonomy view for only a specific view bundle
I would like to define a unique view for a specific taxonomy type that will show anytime a user visits the cannocial URL of a specific term.
The default URL for this is taxonomy/term/[term-id] as ...
1
vote
0
answers
38
views
How to create a view listing vocabularies (not terms)
I'm attempting to create a view that filters and displays a list of vocabularies however I can't seem to find an option to allows me to do so.
In the View settings, I see options for taxonomy terms, ...
0
votes
1
answer
25
views
How can I run a certain action when a taxonomy field value is removed or added? [closed]
I have a user_territories field which can have multiple values. I need to run a certain action when this field value is changed from the user entity, not when other fields are changed.
How can I write ...
-1
votes
1
answer
107
views
save draggableview weight
I have a question related to draggableview (DV) integrated in Drupal 9. How can I save DV weight field value in other content type field called "field_priority" ?
I found this info but it's ...
0
votes
1
answer
37
views
Exclude taxonomy terms from being choosen in facets
I am working on a search field with a facet which has a list of taxonomy terms.
Some taxonomy terms I want to exclude from being choosen, because it is not relevant for people to know about.
How can I ...
0
votes
1
answer
364
views
Print field of taxonomy term in twig
I have a taxonomy term called Event type. Inside that term I have a Color field. I want to pass the HEX value of the Color field as a variable in Twig.
The taxonomy term variable in Twig (on node ...
0
votes
0
answers
94
views
Check if a taxonomy term is a parent or is a child and if all children are selected
How can I know in a twig in a taxonomy field (with multiple term) if a term is parent, if a term is child and if all children are selected for example.
I have a “continent” taxonomy with “region” ...
0
votes
0
answers
44
views
Disable node listings on taxonomy term pages per vocabulary
I have two vocabularies and I'm trying to hide/disable the node listings that automatically appear on the taxonomy term pages (/taxonomy/term/%), only for one of these vocabularies.
I'm not sure if ...
0
votes
1
answer
32
views
Sort nodes based on parent taxonomy term name in views
I have a taxonomy term "Store Locations". I have added terms as State & City by parent child concept. Like this:
I have created Store Locations as node and assign them in the taxonomy ...
1
vote
1
answer
123
views
How to show terms with a specific depth as exposed filter
I would like, on Drupal 9, to show in a view as exposed filter a taxonomy term with depth 0, one with level one (the children) and one with level 2 (level one's children).
Basically I have a content ...
0
votes
0
answers
70
views
Displaying a taxonomy term description in the select list
Select lists have a name|value pair structure. In the case of taxonomy tid|term name.
In order to make data entry faster, people would like the term name in the select list to include the description. ...
0
votes
0
answers
25
views
Pull value from a node field based on another field
I want to be able to update the value of a field based on taxonomy term. I have a term (location) with a custom field (country) and city with corresponding values in this term.
I create a reference ...
0
votes
0
answers
31
views
How do I create a block that displays nodes related to the current page?
I have a taxonomy vocabulary (Tags) with the following terms.
term 1
term 2
term 3
term 4
term 5
term 6
term 7
term 8
term 9
term 10
term 11
term 12
term 13
term 14
term 15
term 16
I have an ...
1
vote
1
answer
407
views
Get all parent term taxonomy id and name of vocabulary
I have a vocabulary (Vehicle) which contains the following taxonomy terms.
Maruti
Alto
Swift
Baleno
Barazza
Hundai
I10
I20
Creta
Tata
Nexon
Safari
Nano
I want to get only the parent taxonomy ...
0
votes
0
answers
91
views
How to display nodes that belong to the same taxonomy term as the current page?
I created a "Categories" taxonomy vocabulary with the following terms and child terms :
- Crypto
-- Binance
-- Ledger
-- Metamask
- Geek
-- Security
-- Apple
...
The "tags" ...
0
votes
0
answers
104
views
How do i list all child terms that share the same parent term? But on "child term" page?
Let's say I have the following taxonomy (a 3-level hierarchy).
Acura
Integra
Hatchback 1991
Hatchback 1995
Hatchback 2000
If I am on the last term of this hierarchy, for example Hatchback 1991, ...