function entity_get_info

Gets the entity definition for an entity type.

Parameters

string|null $entity_type: (optional) The entity type (e.g. 'node'). Leave NULL to retrieve information for all entity types.

Return value

array An array containing the entity type's definition, as retrieved with \Drupal\Core\Entity\EntityManager. If $entity_type is NULL, an associative array of all entity type definitions keyed by entity type is returned.

See also

\Drupal\Core\Entity\EntityManager

hook_entity_info_alter()

73 calls to entity_get_info()
Bundle::init in drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/Bundle.php
Overrides \Drupal\views\Plugin\views\filter\InOperator::init().
ConfigEntityUnitTest::testStorageControllerMethods in drupal/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php
Tests storage controller methods.
config_get_entity_type_by_name in drupal/core/includes/config.inc
Returns the entity type of a configuration object.
config_get_module_config_entities in drupal/core/includes/config.inc
Return a list of all config entity types provided by a module.
DisplayOverview::submitForm in drupal/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
Overrides \Drupal\field_ui\OverviewBase::submitForm().

... See full list

File

drupal/core/includes/entity.inc, line 30
Entity API for handling entities like nodes or users.

Code

function entity_get_info($entity_type = NULL) {
  if (empty($entity_type)) {
    return Drupal::entityManager()
      ->getDefinitions();
  }
  else {
    return Drupal::entityManager()
      ->getDefinition($entity_type);
  }
}