📅  最后修改于: 2022-03-11 14:56:08.383000             🧑  作者: Mango
if (!$entity->get('category')->isEmpty()) {
/** @var EntityInterface $category */
$category = $entity->get('category')->entity;
$row['category']['data'] = [
'#type' => 'link',
'#title' => $category->get('name')->value,
'#url' => $category->toUrl(),
];
}
else {
$row['category'] = NULL;
}