You are here

public function BusinessRulesUtil::getEntityTypes in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Util/BusinessRulesUtil.php \Drupal\business_rules\Util\BusinessRulesUtil::getEntityTypes()

Return all content entity types.

Return value

array Array of entity types. [id => label]

File

src/Util/BusinessRulesUtil.php, line 523

Class

BusinessRulesUtil
Class BusinessRulesUtil.

Namespace

Drupal\business_rules\Util

Code

public function getEntityTypes() {
  $output = [];
  $types = $this->entityTypeManager
    ->getDefinitions();
  foreach ($types as $key => $type) {
    if ($type instanceof ContentEntityType) {
      $output[$key] = $type
        ->getLabel();
    }
  }
  asort($output);
  return $output;
}