Programmatically accessing a term value
The most oft used properties of a taxonomy term have their own methods, like term::getName(). But what do you do when you need a value that does not?
An example of this is the vocabulary ID (vid). This exists in the term an array of a protected member, values. Because of that, one cannot simply reference it as
but this will work
$vid_array = $term->get('vid')->getValue()
Having done that, the value returned is an array. The value is tucked within it and can be accessed with