UUIDController.php in Entity Type Clone 8
Namespace
Drupal\entity_type_clone\ControllerFile
src/Controller/UUIDController.phpView source
<?php
namespace Drupal\entity_type_clone\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\ContentEntityType;
/**
* Class UUIDController.
*
* @package Drupal\entity_type_clone\Controller
*/
class UUIDController extends ControllerBase {
public function uuidGet() {
$uuid = [];
$entity_type_definations = \Drupal::entityTypeManager()
->getDefinitions();
foreach ($entity_type_definations as $definition) {
if ($definition instanceof ContentEntityType) {
$content_types = \Drupal::service('entity_type.bundle.info')
->getBundleInfo($definition
->id());
$entity_type = $definition
->getBundleEntityType();
if ($entity_type && $content_types) {
foreach ($content_types as $type_id => $type) {
$uuid[$entity_type][$type_id] = \Drupal::entityTypeManager()
->getStorage($entity_type)
->load($type_id)
->uuid();
}
}
}
}
return $uuid;
}
}
Classes
Name![]() |
Description |
---|---|
UUIDController | Class UUIDController. |