Equivalent of node_type_get_types() Can somebody help mi with use of node_type_get_types() in Drupal 8?

Code in Drupal 7

function node_type_get_types() {
  return _node_types_build()-&gt;types;
}


Code in Drupal 8

function node_type_get_types() {
  return NodeType::loadMultiple();
}


This was my code in Drupal 7. How to now use node_type_get_types in Drupal 8?

$options = array();
  foreach (node_type_get_types() as $type) {
    $options[$type-&gt;type] = $type-&gt;type;
  }
Node types are (config) entities, so they have the same methods available as others. Specifically, relevant for you, all entities have id() and label() methods:

use Drupal\node\Entity\NodeType;

$options = array();
foreach (NodeType::loadMultiple() as $type) {
  $options[$type-&gt;id()] = $type-&gt;label();
}


Those methods are defined on \Drupal\Core\Entity\EntityInterface, you can use them anything that's an entity and that includes almost every type of content and configurable thing, nodes, users, roles, views, image styles, ...