AdminToolbarToolsHelper.php in Admin Toolbar 8.2
File
admin_toolbar_tools/src/AdminToolbarToolsHelper.php
View source
<?php
namespace Drupal\admin_toolbar_tools;
use Drupal\Core\Entity\EntityTypeManagerInterface;
class AdminToolbarToolsHelper {
protected $entityTypeManager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
public function getBundleableEntitiesList() {
$entity_types = $this->entityTypeManager
->getDefinitions();
$content_entities = [];
foreach ($entity_types as $key => $entity_type) {
if ($entity_type
->getBundleEntityType() && $entity_type
->get('field_ui_base_route') != '') {
$content_entities[$key] = [
'content_entity' => $key,
'content_entity_bundle' => $entity_type
->getBundleEntityType(),
];
}
}
return $content_entities;
}
public function getRebuildEntityTypes() {
$types = [
'menu',
];
$content_entities = $this
->getBundleableEntitiesList();
$types = array_merge($types, array_column($content_entities, 'content_entity_bundle'));
return $types;
}
}