Get all existing content type ids from their nodes.

PHOTO EMBED

Thu Jan 27 2022 09:16:58 GMT+0000 (Coordinated Universal Time)

Saved by @igor #drupal #php

$types = [];
$contentTypes = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
foreach ($contentTypes as $contentType) {
  $types[] = $contentType->id();
}
content_copyCOPY