【发布时间】:2018-08-20 08:18:05
【问题描述】:
我正在尝试将自定义字段分配给分类。我试过这个:
$vid = 'zeme';
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
$terms 现在存储名为“zeme”的词汇表中的所有术语。问题是当我打印这个变量时,它没有显示我需要获取的自定义字段。 知道如何获得这个自定义字段吗? 我的代码如下所示:
$vid = 'zeme';
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
foreach ($terms as $term) {
$term_data[] = array(
'id' => $term->tid,
'name' => $term->name
);
}
【问题讨论】:
标签: arrays drupal-8 drupal-taxonomy