How can I print the vocabulary name instead of the referenced term in a node template?List child terms according to parent term pageHow to programmatically modify fields of taxonomy terms?How do I show the number of nodes using a taxonomy term?Back to the viewHow do I get the vocabulary of a term inside an “article” type content type?View Path TaxonomyTerm/sub-pageTaxonomy overview search termHow to limit access to vocabulary term by role?How to display content for a Taxonomy Vocabulary?

Practically, how does an 'observer' collapse a wave function?

Apollo image lighting

Can the target of Feign Death speak, move, and dodge a fireball

How can I tell if I have simplified my talk too much?

How can I run a cable past a horizontal block between studs in my wall?

Meaning of これでもかという forms

What does Google's claim of "Quantum Supremacy" mean for the question of BQP vs BPP vs NP?

Black hole as a storage device?

Why combine commands on a single line in a Bash script?

Tourist / simple city maps to print

Does the Force travel through space-time?

Is it possible to have a healthy work-life balance as a professor?

Was the payload bay of the Space Shuttle depressurized before launch?

Is there a name for this equivalence relation?

Left a meeting without apparent reason. What to do?

What are the applications of the Mean Value Theorem?

What does it mean to support the brexit deal but need more time to scrutinise it?

What to do with developers who don't follow requirements?

Authentication versus Authorisation

Why derailleur guard is present only on more affordable bicycles

Dealing with recruiters who clearly didn't look at my resume

What helped Einstein to provide a more accurate description of gravity than Newton?

What are those two silvery objects resting on Ben Kenobi's table when R2-D2 plays Princess Leia's message?

Civilisation on a Cube Planet



How can I print the vocabulary name instead of the referenced term in a node template?


List child terms according to parent term pageHow to programmatically modify fields of taxonomy terms?How do I show the number of nodes using a taxonomy term?Back to the viewHow do I get the vocabulary of a term inside an “article” type content type?View Path TaxonomyTerm/sub-pageTaxonomy overview search termHow to limit access to vocabulary term by role?How to display content for a Taxonomy Vocabulary?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









1

















Let's say I have a content type article with a field "taxonomy".



The vocabulary is "fruits".



The terms are "apple", "orange", "bananas"



The article belongs to "orange".



I can easily print in my twig template the term of the article :



 content.field_taxo_fruit 


Result is "orange".



But I don't find an easy way to print the vocabulary : "fruits".



On an other project, I used views field and I used "rewrite result". But here, I use twig template like node--article--teaser.html.twig










share|improve this question


































    1

















    Let's say I have a content type article with a field "taxonomy".



    The vocabulary is "fruits".



    The terms are "apple", "orange", "bananas"



    The article belongs to "orange".



    I can easily print in my twig template the term of the article :



     content.field_taxo_fruit 


    Result is "orange".



    But I don't find an easy way to print the vocabulary : "fruits".



    On an other project, I used views field and I used "rewrite result". But here, I use twig template like node--article--teaser.html.twig










    share|improve this question






























      1












      1








      1








      Let's say I have a content type article with a field "taxonomy".



      The vocabulary is "fruits".



      The terms are "apple", "orange", "bananas"



      The article belongs to "orange".



      I can easily print in my twig template the term of the article :



       content.field_taxo_fruit 


      Result is "orange".



      But I don't find an easy way to print the vocabulary : "fruits".



      On an other project, I used views field and I used "rewrite result". But here, I use twig template like node--article--teaser.html.twig










      share|improve this question

















      Let's say I have a content type article with a field "taxonomy".



      The vocabulary is "fruits".



      The terms are "apple", "orange", "bananas"



      The article belongs to "orange".



      I can easily print in my twig template the term of the article :



       content.field_taxo_fruit 


      Result is "orange".



      But I don't find an easy way to print the vocabulary : "fruits".



      On an other project, I used views field and I used "rewrite result". But here, I use twig template like node--article--teaser.html.twig







      8 theming taxonomy-terms






      share|improve this question
















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 14 at 14:52









      leymannx

      8,9225 gold badges38 silver badges73 bronze badges




      8,9225 gold badges38 silver badges73 bronze badges










      asked Jun 14 at 10:35









      Sébastien GicquelSébastien Gicquel

      5497 silver badges24 bronze badges




      5497 silver badges24 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          2


















          You can install Devel's submodule Kint, and then in your template print kint() to get a pretty-printed dump of all available variables.



          Unfortunately I couldn't find the vocabulary label/name in there. Only the field label:



           content.field_taxo_fruit['#title'] 


          @4k4's answer below only prints the vocabulary's machine name. But not the label/name. But I finally got hold of the vocabulary name in a preprocess function in MYTHEME.theme from where I sent it over to Twig:



          function MYTHEME_preprocess_node__article(&$variables) 

          $node = $variables['node'];

          $vid = array_values($node->field_taxo_fruit->getSettings()['handler_settings']['target_bundles'])[0];

          $vocabulary = Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);

          $variables['taxo_fruit_vocab'] = $vocabulary->label();



          And in node--article.html.twig then it's:



          % if taxo_fruit_vocab %
          <div class="taxo-fruit-vocab">
          Vocab: taxo_fruit_vocab
          </div>
          % endif %





          share|improve this answer




























          • +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

            – 4k4
            Jun 14 at 14:13











          • Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

            – Sébastien Gicquel
            Jun 14 at 14:23












          • @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

            – Sébastien Gicquel
            Jun 14 at 14:30












          • @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

            – leymannx
            Jun 14 at 14:39







          • 2





            No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

            – Sébastien Gicquel
            Jun 14 at 15:11



















          2


















          The vocabulary machine name is the bundle ID of the term, which you can get through the node object:



           node.field_taxo.entity.bundle 


          To load the label of the vocabulary:



           node.field_taxo.entity.vid.entity.label 


          This works only when the field has content. For an empty field you would have to dig into the field definition you get from the same field object and check whether the field is restricted to a single target bundle.






          share|improve this answer




























          • Ah yeah! Unfortunately it only prints the vid, not the label.

            – leymannx
            Jun 14 at 15:02











          • @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

            – 4k4
            Jun 16 at 13:40











          • You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

            – leymannx
            Jun 16 at 13:47











          • @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

            – 4k4
            Jun 16 at 20:25













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "220"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdrupal.stackexchange.com%2fquestions%2f282283%2fhow-can-i-print-the-vocabulary-name-instead-of-the-referenced-term-in-a-node-tem%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown


























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2


















          You can install Devel's submodule Kint, and then in your template print kint() to get a pretty-printed dump of all available variables.



          Unfortunately I couldn't find the vocabulary label/name in there. Only the field label:



           content.field_taxo_fruit['#title'] 


          @4k4's answer below only prints the vocabulary's machine name. But not the label/name. But I finally got hold of the vocabulary name in a preprocess function in MYTHEME.theme from where I sent it over to Twig:



          function MYTHEME_preprocess_node__article(&$variables) 

          $node = $variables['node'];

          $vid = array_values($node->field_taxo_fruit->getSettings()['handler_settings']['target_bundles'])[0];

          $vocabulary = Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);

          $variables['taxo_fruit_vocab'] = $vocabulary->label();



          And in node--article.html.twig then it's:



          % if taxo_fruit_vocab %
          <div class="taxo-fruit-vocab">
          Vocab: taxo_fruit_vocab
          </div>
          % endif %





          share|improve this answer




























          • +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

            – 4k4
            Jun 14 at 14:13











          • Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

            – Sébastien Gicquel
            Jun 14 at 14:23












          • @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

            – Sébastien Gicquel
            Jun 14 at 14:30












          • @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

            – leymannx
            Jun 14 at 14:39







          • 2





            No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

            – Sébastien Gicquel
            Jun 14 at 15:11
















          2


















          You can install Devel's submodule Kint, and then in your template print kint() to get a pretty-printed dump of all available variables.



          Unfortunately I couldn't find the vocabulary label/name in there. Only the field label:



           content.field_taxo_fruit['#title'] 


          @4k4's answer below only prints the vocabulary's machine name. But not the label/name. But I finally got hold of the vocabulary name in a preprocess function in MYTHEME.theme from where I sent it over to Twig:



          function MYTHEME_preprocess_node__article(&$variables) 

          $node = $variables['node'];

          $vid = array_values($node->field_taxo_fruit->getSettings()['handler_settings']['target_bundles'])[0];

          $vocabulary = Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);

          $variables['taxo_fruit_vocab'] = $vocabulary->label();



          And in node--article.html.twig then it's:



          % if taxo_fruit_vocab %
          <div class="taxo-fruit-vocab">
          Vocab: taxo_fruit_vocab
          </div>
          % endif %





          share|improve this answer




























          • +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

            – 4k4
            Jun 14 at 14:13











          • Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

            – Sébastien Gicquel
            Jun 14 at 14:23












          • @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

            – Sébastien Gicquel
            Jun 14 at 14:30












          • @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

            – leymannx
            Jun 14 at 14:39







          • 2





            No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

            – Sébastien Gicquel
            Jun 14 at 15:11














          2














          2










          2









          You can install Devel's submodule Kint, and then in your template print kint() to get a pretty-printed dump of all available variables.



          Unfortunately I couldn't find the vocabulary label/name in there. Only the field label:



           content.field_taxo_fruit['#title'] 


          @4k4's answer below only prints the vocabulary's machine name. But not the label/name. But I finally got hold of the vocabulary name in a preprocess function in MYTHEME.theme from where I sent it over to Twig:



          function MYTHEME_preprocess_node__article(&$variables) 

          $node = $variables['node'];

          $vid = array_values($node->field_taxo_fruit->getSettings()['handler_settings']['target_bundles'])[0];

          $vocabulary = Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);

          $variables['taxo_fruit_vocab'] = $vocabulary->label();



          And in node--article.html.twig then it's:



          % if taxo_fruit_vocab %
          <div class="taxo-fruit-vocab">
          Vocab: taxo_fruit_vocab
          </div>
          % endif %





          share|improve this answer
















          You can install Devel's submodule Kint, and then in your template print kint() to get a pretty-printed dump of all available variables.



          Unfortunately I couldn't find the vocabulary label/name in there. Only the field label:



           content.field_taxo_fruit['#title'] 


          @4k4's answer below only prints the vocabulary's machine name. But not the label/name. But I finally got hold of the vocabulary name in a preprocess function in MYTHEME.theme from where I sent it over to Twig:



          function MYTHEME_preprocess_node__article(&$variables) 

          $node = $variables['node'];

          $vid = array_values($node->field_taxo_fruit->getSettings()['handler_settings']['target_bundles'])[0];

          $vocabulary = Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);

          $variables['taxo_fruit_vocab'] = $vocabulary->label();



          And in node--article.html.twig then it's:



          % if taxo_fruit_vocab %
          <div class="taxo-fruit-vocab">
          Vocab: taxo_fruit_vocab
          </div>
          % endif %






          share|improve this answer















          share|improve this answer




          share|improve this answer








          edited Jun 14 at 15:00

























          answered Jun 14 at 14:08









          leymannxleymannx

          8,9225 gold badges38 silver badges73 bronze badges




          8,9225 gold badges38 silver badges73 bronze badges















          • +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

            – 4k4
            Jun 14 at 14:13











          • Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

            – Sébastien Gicquel
            Jun 14 at 14:23












          • @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

            – Sébastien Gicquel
            Jun 14 at 14:30












          • @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

            – leymannx
            Jun 14 at 14:39







          • 2





            No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

            – Sébastien Gicquel
            Jun 14 at 15:11


















          • +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

            – 4k4
            Jun 14 at 14:13











          • Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

            – Sébastien Gicquel
            Jun 14 at 14:23












          • @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

            – Sébastien Gicquel
            Jun 14 at 14:30












          • @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

            – leymannx
            Jun 14 at 14:39







          • 2





            No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

            – Sébastien Gicquel
            Jun 14 at 15:11

















          +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

          – 4k4
          Jun 14 at 14:13





          +1, your approach is what you should try first before digging into the field object like i've tried in my answer.

          – 4k4
          Jun 14 at 14:13













          Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

          – Sébastien Gicquel
          Jun 14 at 14:23






          Perfect, I always try first with admin UI but I hadn't thought of "the label solution".

          – Sébastien Gicquel
          Jun 14 at 14:23














          @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

          – Sébastien Gicquel
          Jun 14 at 14:30






          @4k4 I found this interesting : It works but it is not really the taxonomy vocabulary name which is printed but the field name (entity reference field). Am I right ?

          – Sébastien Gicquel
          Jun 14 at 14:30














          @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

          – leymannx
          Jun 14 at 14:39






          @SébastienGicquel – Yes indeed. I only noticed it too late. Wait a minute, I'm already looking the vocabulary up. Unfortunately 4k4's solution didn't printed it for me.

          – leymannx
          Jun 14 at 14:39





          2




          2





          No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

          – Sébastien Gicquel
          Jun 14 at 15:11






          No worries, thanks for answering so quickly. @4k4 solution is working partially in my project, it prints the sanitized name of vocabulary (Notice the node.xxxInstead of content.xxx in his answer) I will try your solution and send you a feed back.

          – Sébastien Gicquel
          Jun 14 at 15:11














          2


















          The vocabulary machine name is the bundle ID of the term, which you can get through the node object:



           node.field_taxo.entity.bundle 


          To load the label of the vocabulary:



           node.field_taxo.entity.vid.entity.label 


          This works only when the field has content. For an empty field you would have to dig into the field definition you get from the same field object and check whether the field is restricted to a single target bundle.






          share|improve this answer




























          • Ah yeah! Unfortunately it only prints the vid, not the label.

            – leymannx
            Jun 14 at 15:02











          • @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

            – 4k4
            Jun 16 at 13:40











          • You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

            – leymannx
            Jun 16 at 13:47











          • @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

            – 4k4
            Jun 16 at 20:25
















          2


















          The vocabulary machine name is the bundle ID of the term, which you can get through the node object:



           node.field_taxo.entity.bundle 


          To load the label of the vocabulary:



           node.field_taxo.entity.vid.entity.label 


          This works only when the field has content. For an empty field you would have to dig into the field definition you get from the same field object and check whether the field is restricted to a single target bundle.






          share|improve this answer




























          • Ah yeah! Unfortunately it only prints the vid, not the label.

            – leymannx
            Jun 14 at 15:02











          • @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

            – 4k4
            Jun 16 at 13:40











          • You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

            – leymannx
            Jun 16 at 13:47











          • @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

            – 4k4
            Jun 16 at 20:25














          2














          2










          2









          The vocabulary machine name is the bundle ID of the term, which you can get through the node object:



           node.field_taxo.entity.bundle 


          To load the label of the vocabulary:



           node.field_taxo.entity.vid.entity.label 


          This works only when the field has content. For an empty field you would have to dig into the field definition you get from the same field object and check whether the field is restricted to a single target bundle.






          share|improve this answer
















          The vocabulary machine name is the bundle ID of the term, which you can get through the node object:



           node.field_taxo.entity.bundle 


          To load the label of the vocabulary:



           node.field_taxo.entity.vid.entity.label 


          This works only when the field has content. For an empty field you would have to dig into the field definition you get from the same field object and check whether the field is restricted to a single target bundle.







          share|improve this answer















          share|improve this answer




          share|improve this answer








          edited Jun 16 at 13:40

























          answered Jun 14 at 14:08









          4k44k4

          59.7k5 gold badges74 silver badges121 bronze badges




          59.7k5 gold badges74 silver badges121 bronze badges















          • Ah yeah! Unfortunately it only prints the vid, not the label.

            – leymannx
            Jun 14 at 15:02











          • @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

            – 4k4
            Jun 16 at 13:40











          • You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

            – leymannx
            Jun 16 at 13:47











          • @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

            – 4k4
            Jun 16 at 20:25


















          • Ah yeah! Unfortunately it only prints the vid, not the label.

            – leymannx
            Jun 14 at 15:02











          • @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

            – 4k4
            Jun 16 at 13:40











          • You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

            – leymannx
            Jun 16 at 13:47











          • @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

            – 4k4
            Jun 16 at 20:25

















          Ah yeah! Unfortunately it only prints the vid, not the label.

          – leymannx
          Jun 14 at 15:02





          Ah yeah! Unfortunately it only prints the vid, not the label.

          – leymannx
          Jun 14 at 15:02













          @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

          – 4k4
          Jun 16 at 13:40





          @leymannx, you can load the label in Twig too, because the term references the bundle config entity. I add this to the answer.

          – 4k4
          Jun 16 at 13:40













          You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

          – leymannx
          Jun 16 at 13:47





          You are genius. But from where do you know this? Is it basically just the same pattern for every entity? Or did you dig really deep in what kint() returned you? I asked OP to accept your answer instead.

          – leymannx
          Jun 16 at 13:47













          @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

          – 4k4
          Jun 16 at 20:25






          @leymannx, this pattern is the same for any content entity with bundles. BTW I think both answers are valid, mine is more literal, yours considering the overall context, although it would need some clarification, machine name (fruits looks like one) or label, vocabulary from the content or field config.

          – 4k4
          Jun 16 at 20:25



















          draft saved

          draft discarded















































          Thanks for contributing an answer to Drupal Answers!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdrupal.stackexchange.com%2fquestions%2f282283%2fhow-can-i-print-the-vocabulary-name-instead-of-the-referenced-term-in-a-node-tem%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown









          Popular posts from this blog

          Tamil (spriik) Luke uk diar | Nawigatjuun

          Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

          Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?