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