I need to get vocabulary ID by term object.Please see attched screenshot for term object.enter image description here


Since the getVocabularyId() function is deprecated and will be removed in Drupal 9.0.0, you now need :

$vocabulary_id = $term->bundle();

See EntityInterface::bundle for more information.


I think we're supposed to use EntityInterface::bundle now as Term::getVocabularyId is deprecated:

Scheduled for removal before Drupal 9.0.0. Use TermInterface::bundle() instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.