我正在研究 Drupal 8。我想获取内容类型机器名称和标签。这是我的代码:
$cont_type = node_type_get_types();
foreach ($cont_type as $key => $value) {
$label = $value->name;
$machine_name = $key;
}
在这里我收到一条错误消息:Cannot access protected property Drupal\node\Entity\NodeType::$name