drupal 8 get taxonomy term value in node

后端 未结 6 961
既然无缘
既然无缘 2021-02-08 05:36

Drupal\\node\\Entity\\Node Object ( [in_preview] => [values:protected] => Array ( [vid] => Array ( [x-default] =

6条回答
  •  不思量自难忘°
    2021-02-08 05:58

    Do this

    use Drupal\taxonomy\Entity\Term;
    $term = Term::load($node->get('field_destination')->target_id);
    $termname = $term->getName();
    

    In drupal8 we used to follow oops approach to get the values.

提交回复
热议问题