I have few node types and some of them have an extra field is linked to taxonomy vocabulary. How can i get taxonomy vocabulary id or name if i know field name and node type where this field there exists?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Drupal 7 fields can be added to any entity/bundle, and for a term reference field the vocabularies used are set on the field level, not on the entity/bundle level.
So you don’t need to query the field settings for a particular content type, but simply the settings for the field itself. The vocabulary machine names are stored in the
allowed_valueskey of thesettingsarray returned fromfield_info_field():Hope that helps