function hook_entity_info

Add to entity type definitions.

Modules may implement this hook to add information to defined entity types.

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

4 functions implement hook_entity_info()

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

book_entity_info in drupal/core/modules/book/book.module
Implements hook_entity_info().
comment_entity_info in drupal/core/modules/comment/comment.module
Implements hook_entity_info().
node_entity_info in drupal/core/modules/node/node.module
Implements hook_entity_info().
taxonomy_entity_info in drupal/core/modules/taxonomy/taxonomy.module
Implements hook_entity_info().

File

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

Code

function hook_entity_info(&$entity_info) {

  // Add the 'Print' view mode for nodes.
  $entity_info['node']['view_modes']['print'] = array(
    'label' => t('Print'),
    'custom_settings' => FALSE,
  );
}