Created
April 11, 2017 17:28
-
-
Save crittermike/2e8267327399685dabe18f3c8ff338a3 to your computer and use it in GitHub Desktop.
Find the parent of a taxonomy term in Drupal 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$parents = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($term_id); | |
$parent_term = reset($parents); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment