function hook_entity_info_alter

Alter the entity type definitions.

Modules may implement this hook to alter the information that defines an entity type. All properties that are available in \Drupal\Core\Entity\EntityManager can be altered here.

Do not use this hook to add information to entity types. Use hook_entity_info() for that instead.

Parameters

array $entity_info: An associative array of all entity type definitions, keyed by the entity type name. Passed by reference.

See also

\Drupal\Core\Entity\Entity

\Drupal\Core\Entity\EntityManager

entity_get_info()

Related topics

9 functions implement hook_entity_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

comment_test_entity_info_alter in drupal/core/modules/comment/tests/modules/comment_test/comment_test.module
Implements hook_entity_info_alter().
config_test_entity_info_alter in drupal/core/modules/config/tests/config_test/config_test.module
Implements hook_entity_info_alter().
custom_block_entity_info_alter in drupal/core/modules/block/custom_block/custom_block.module
Implements hook_entity_info_alter().
entity_cache_test_dependency_entity_info_alter in drupal/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
Implements hook_entity_info_alter().
entity_test_entity_info_alter in drupal/core/modules/system/tests/modules/entity_test/entity_test.module
Implements hook_entity_info_alter().

... See full list

File

drupal/core/includes/entity.api.php, line 158
Hooks provided the Entity module.

Code

function hook_entity_info_alter(&$entity_info) {

  // Set the controller class for nodes to an alternate implementation of the
  // Drupal\Core\Entity\EntityStorageControllerInterface interface.
  $entity_info['node']['controllers']['storage'] = 'Drupal\\mymodule\\MyCustomNodeStorageController';
}