public function BlockEntityStorage::getEntityTypesUsed in Field as Block 8.2
Get all entity type ids that are currently used in Field Blocks.
This will also return entity type ids for entities that are no longer available.
Return value
array Entity type machine names.
File
- src/
BlockEntityStorage.php, line 90
Class
- BlockEntityStorage
- Class BlockEntityStorage.
Namespace
Drupal\fieldblockCode
public function getEntityTypesUsed() {
$blocks = $this
->loadFieldBlocks();
$entity_types = [];
/** @var \Drupal\block\Entity\Block $block */
foreach ($blocks as $block) {
$plugin_parts = explode(':', $block
->get('plugin'));
$entity_types[] = $plugin_parts['1'];
}
return $entity_types;
}