You are here

public static function ConvertNodes::getContentTypes in Convert Nodes 8

1 call to ConvertNodes::getContentTypes()
ConvertNodesForm::buildForm in src/Form/ConvertNodesForm.php
Form constructor.

File

src/ConvertNodes.php, line 89

Class

ConvertNodes
ConvertNodes.

Namespace

Drupal\convert_nodes

Code

public static function getContentTypes() {
  $contentTypes = \Drupal::service('entity_type.manager')
    ->getStorage('node_type')
    ->loadMultiple();
  $contentTypesList = [];
  foreach ($contentTypes as $contentType) {
    $contentTypesList[$contentType
      ->id()] = $contentType
      ->label();
  }
  return $contentTypesList;
}