diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 798c055..21edd6f 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -101,11 +101,6 @@ function comment_help($path, $arg) { * Implements hook_entity_info_alter(). */ function comment_entity_info_alter(&$info) { - $info['comment']['view_modes']['full'] = array( - 'label' => t('Full comment'), - 'custom settings' => FALSE, - ); - foreach (node_type_get_names() as $type => $name) { $info['comment']['bundles']['comment_node_' . $type] = array( 'label' => t('@node_type comment', array('@node_type' => $name)), diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php index c2dd9f2..affbee8 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php @@ -33,6 +33,12 @@ * "bundle" = "node_type", * "label" = "subject", * "uuid" = "uuid" + * }, + * view_modes = { + * "full" = { + * "label" = "Full comment", + * "custom settings" = FALSE + * } * } * ) */ diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 4588d4d..f56f7a1 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -88,16 +88,6 @@ function file_element_info() { } /** - * Implements hook_entity_info_alter(). - */ -function file_entity_info_alter(&$info) { - $info['file']['view_modes']['full'] = array( - 'label' => t('File default'), - 'custom settings' => FALSE, - ); -} - -/** * Loads file entities from the database. * * @param array $fids diff --git a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php index d7f2a6b..ae05373 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php +++ b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php @@ -26,6 +26,12 @@ * "id" = "fid", * "label" = "filename", * "uuid" = "uuid" + * }, + * view_modes = { + * "full" = { + * "label" = "File default", + * "custom settings" = FALSE + * } * } * ) */ diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 71135a4..a62837e 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -172,6 +172,16 @@ function language_permission() { } /** + * Implements hook_entity_info_alter(). + */ +function language_entity_info_alter(&$info) { + // Add a translation handler for fields if the node module is enabled. + if (module_exists('node')) { + $info['node']['translation']['node'] = TRUE; + } +} + +/** * Implements hook_theme(). */ function language_theme() { diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index b828c71..3c4302f 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -34,6 +34,23 @@ * "bundle" = "type", * "label" = "title", * "uuid" = "uuid" + * }, + * bundle_keys = { + * "bundle" = "type" + * }, + * view_modes = { + * "full" = { + * "label" = "Full content", + * "custom settings" = FALSE + * }, + * "teaser" = { + * "label" = "Teaser", + * "custom settings" = FALSE + * }, + * "rss" = { + * "label" = "RSS", + * "custom settings" = FALSE + * } * } * ) */ diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 7f90db6..7ba2c1b 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -194,40 +194,6 @@ function node_cron() { * Implements hook_entity_info_alter(). */ function node_entity_info_alter(&$info) { - $info['node']['bundle_keys'] = array( - 'bundle' => 'type', - ); - $info['node']['view_modes']['full'] = array( - 'label' => t('Full content'), - 'custom settings' => FALSE, - ); - $info['node']['view_modes']['teaser'] = array( - 'label' => t('Teaser'), - 'custom settings' => TRUE, - ); - $info['node']['view_modes']['rss'] = array( - 'label' => t('RSS'), - 'custom settings' => FALSE, - ); - - // Add a translation handler for fields if the language module is enabled. - if (module_exists('language')) { - $info['node']['translation']['node'] = TRUE; - } - - // Search integration is provided by node.module, so search-related - // view modes for nodes are defined here and not in search.module. - if (module_exists('search')) { - $info['node']['view_modes']['search_index'] = array( - 'label' => t('Search index'), - 'custom settings' => FALSE, - ); - $info['node']['view_modes']['search_result'] = array( - 'label' => t('Search result'), - 'custom settings' => FALSE, - ); - } - // Bundles must provide a human readable name so we can create help and error // messages, and the path to attach Field admin pages to. node_type_cache_reset(); diff --git a/core/modules/search/search.module b/core/modules/search/search.module index a32b5c3..45c96f9 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -134,6 +134,22 @@ function search_permission() { } /** + * Implements hook_entity_info_alter(). + */ +function search_entity_info_alter(&$info) { + if (module_exists('node')) { + $info['node']['view_modes']['search_index'] = array( + 'label' => t('Search index'), + 'custom settings' => FALSE, + ); + $info['node']['view_modes']['search_result'] = array( + 'label' => t('Search result'), + 'custom settings' => FALSE, + ); + } +} + +/** * Implements hook_block_info(). */ function search_block_info() { diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php index 3b4b121..4b2640e 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php @@ -32,6 +32,15 @@ * "bundle" = "vocabulary_machine_name", * "label" = "name", * "uuid" = "uuid" + * }, + * bundle_keys = { + * "bundle" = "machine_name" + * }, + * view_modes = { + * "full" = { + * "label" = "Taxonomy term page", + * "custom settings" = FALSE + * } * } * ) */ diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php index beee8d1..a5b21b1 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php @@ -26,6 +26,12 @@ * entity_keys = { * "id" = "vid", * "label" = "name" + * }, + * view_modes = { + * "full" = { + * "label" = "Taxonomy vocabulary", + * "custom settings" = FALSE + * } * } * ) */ diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index ceba797..058b80b 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -109,13 +109,6 @@ function taxonomy_permission() { * Implements hook_entity_info_alter(). */ function taxonomy_entity_info_alter(&$info) { - $info['taxonomy_term']['bundle_keys'] = array( - 'bundle' => 'machine_name', - ); - $info['taxonomy_term']['view_modes']['full'] = array( - 'label' => t('Taxonomy term page'), - 'custom settings' => FALSE, - ); foreach (taxonomy_vocabulary_get_names() as $machine_name => $vocabulary) { $info['taxonomy_term']['bundles'][$machine_name] = array( 'label' => $vocabulary->name, @@ -127,10 +120,6 @@ function taxonomy_entity_info_alter(&$info) { ), ); } - $info['taxonomy_vocabulary']['view_modes']['full'] = array( - 'label' => t('Taxonomy vocabulary default'), - 'custom settings' => FALSE, - ); } /** diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php index 4fa5b12..d87979a 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php @@ -31,6 +31,21 @@ * entity_keys = { * "id" = "uid", * "uuid" = "uuid" + * }, + * bundles = { + * "user" = { + * "label" = "User", + * "admin" = { + * "path" = "admin/config/people/accounts", + * "access arguments" = {"administer users"} + * } + * } + * }, + * view_modes = { + * "full" = { + * "label" = "User account", + * "custom settings" = FALSE + * } * } * ) */ diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 8b05731..06cdc8f 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -139,23 +139,6 @@ function user_theme() { } /** - * Implements hook_entity_info_alter(). - */ -function user_entity_info_alter(&$info) { - $info['user']['bundles']['user'] = array( - 'label' => t('User'), - 'admin' => array( - 'path' => 'admin/config/people/accounts', - 'access arguments' => array('administer users'), - ), - ); - $info['user']['view_modes']['full'] = array( - 'label' => t('User account'), - 'custom settings' => FALSE, - ); -} - -/** * Entity URI callback. */ function user_uri($user) {