I'm working on Drupal 8 and I want to get content type machine name and label. Here is my code:
$cont_type = node_type_get_types();
foreach ($cont_type as $key => $value) {
$label = $value->name;
$machine_name = $key;
}
I get the following error message:
Cannot access protected property
Drupal\node\Entity\NodeType::$name
Hoe can I get the content type name?