diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index ba9b740..b5156bf 100644 --- a/core/includes/entity.api.php +++ b/core/includes/entity.api.php @@ -37,19 +37,17 @@ * display settings specific to the view mode. * * @see entity_get_view_modes() - * @see hook_entity_view_modes_info_alter() + * @see hook_entity_view_mode_info_alter() */ -function hook_entity_view_modes_info() { - $info = array(); - $info['user']['full'] = array( +function hook_entity_view_mode_info() { + $view_modes['user']['full'] = array( 'label' => t('User account'), - 'custom_settings' => FALSE, ); - $info['user']['compact'] = array( + $view_modes['user']['compact'] = array( 'label' => t('Compact'), 'custom_settings' => TRUE, ); - return $info; + return $view_modes; } /** @@ -59,9 +57,9 @@ function hook_entity_view_modes_info() { * An array of view modes, keyed first by entity type, then by view mode name. * * @see entity_get_view_modes() - * @see hook_entity_view_modes_info() + * @see hook_entity_view_mode_info() */ -function hook_entity_view_modes_info_alter(&$view_modes) { +function hook_entity_view_mode_info_alter(&$view_modes) { $view_modes['user']['full']['custom_settings'] = TRUE; } @@ -91,17 +89,16 @@ function hook_entity_view_modes_info_alter(&$view_modes) { * - access arguments: As in hook_menu(). * * @see entity_get_bundles() - * @see hook_entity_bundles_info_alter() + * @see hook_entity_bundle_info_alter() */ -function hook_entity_bundles_info() { - $info = array(); - $info['user']['user'] = array( +function hook_entity_bundle_info() { + $bundles['user']['user'] = array( 'label' => t('User'), 'admin' => array( 'path' => 'admin/config/people/accounts', ), ); - return $info; + return $bundles; } /** @@ -111,9 +108,9 @@ function hook_entity_bundles_info() { * An array of bundles, keyed first by entity type, then by bundle name. * * @see entity_get_bundles() - * @see hook_entity_bundles_info() + * @see hook_entity_bundle_info() */ -function hook_entity_bundles_info_alter(&$bundles) { +function hook_entity_bundle_info_alter(&$bundles) { $bundles['user']['user']['label'] = t('Full account'); } diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 3c3be09..2d21e82 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -69,19 +69,19 @@ function entity_get_bundles($entity_type = NULL) { $bundles = &drupal_static(__FUNCTION__); if (!$bundles) { $langcode = language(LANGUAGE_TYPE_INTERFACE)->langcode; - if ($cache = cache()->get("entity_bundles_info:$langcode")) { + if ($cache = cache()->get("entity_bundle_info:$langcode")) { $bundles = $cache->data; } else { - $bundles = module_invoke_all('entity_bundles_info'); + $bundles = module_invoke_all('entity_bundle_info'); // If no bundles are provided, use the entity type name and label. foreach (entity_get_info() as $type => $entity_info) { if (!isset($bundles[$type])) { $bundles[$type][$type]['label'] = $entity_info['label']; } } - drupal_alter('entity_bundles_info', $bundles); - cache()->set("entity_bundles_info:$langcode", $bundles, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE)); + drupal_alter('entity_bundle_info', $bundles); + cache()->set("entity_bundle_info:$langcode", $bundles, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE)); } } @@ -109,11 +109,11 @@ function entity_get_view_modes($entity_type = NULL) { $view_modes = &drupal_static(__FUNCTION__); if (!$view_modes) { $langcode = language(LANGUAGE_TYPE_INTERFACE)->langcode; - if ($cache = cache()->get("entity_view_modes_info:$langcode")) { + if ($cache = cache()->get("entity_view_mode_info:$langcode")) { $view_modes = $cache->data; } else { - $view_modes = module_invoke_all('entity_view_modes_info'); + $view_modes = module_invoke_all('entity_view_mode_info'); foreach ($view_modes as $type => $entity_info) { foreach ($entity_info as $view_mode => $view_mode_info) { $view_modes[$type][$view_mode] += array( @@ -121,8 +121,8 @@ function entity_get_view_modes($entity_type = NULL) { ); } } - drupal_alter('entity_view_modes_info', $view_modes); - cache()->set("entity_view_modes_info:$langcode", $view_modes, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE)); + drupal_alter('entity_view_mode_info', $view_modes); + cache()->set("entity_view_mode_info:$langcode", $view_modes, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE)); } } diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 00c2807..248759f 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -250,15 +250,14 @@ function book_admin_paths() { } /** - * Implements hook_entity_view_modes_info(). + * Implements hook_entity_view_mode_info(). */ -function book_entity_view_modes_info() { +function book_entity_view_mode_info() { // Add the 'Print' view mode for nodes. - $info['node']['print'] = array( + $view_modes['node']['print'] = array( 'label' => t('Print'), - 'custom_settings' => FALSE, ); - return $info; + return $view_modes; } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 1bd7b53..554b635 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -99,24 +99,22 @@ function comment_help($path, $arg) { } /** - * Implements hook_entity_view_modes_info(). + * Implements hook_entity_view_mode_info(). */ -function comment_entity_view_modes_info() { - $info = array(); - $info['comment']['full'] = array( +function comment_entity_view_mode_info() { + $view_modes['comment']['full'] = array( 'label' => t('Full comment'), - 'custom_settings' => FALSE, ); - return $info; + return $view_modes; } /** - * Implements hook_entity_bundles_info(). + * Implements hook_entity_bundle_info(). */ -function comment_entity_bundles_info() { - $info = array(); +function comment_entity_bundle_info() { + $bundles = array(); foreach (node_type_get_names() as $type => $name) { - $info['comment']['comment_node_' . $type] = array( + $bundles['comment']['comment_node_' . $type] = array( 'label' => t('@node_type comment', array('@node_type' => $name)), // Provide the node type/bundle name for other modules, so it does not // have to be extracted manually from the bundle name. @@ -134,7 +132,7 @@ function comment_entity_bundles_info() { ), ); } - return $info; + return $bundles; } /** @@ -303,7 +301,7 @@ function comment_menu_alter(&$items) { $items['admin/content']['description'] = 'Administer content and comments.'; // Adjust the Field UI tabs on admin/structure/types/manage/[node-type]. - // See comment_entity_bundles_info(). + // See comment_entity_bundle_info(). $items['admin/structure/types/manage/%comment_node_type/comment/fields']['title'] = 'Comment fields'; $items['admin/structure/types/manage/%comment_node_type/comment/fields']['weight'] = 3; $items['admin/structure/types/manage/%comment_node_type/comment/display']['title'] = 'Comment display'; diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index c78c860..2686b80 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -174,13 +174,13 @@ function _contact_personal_tab_access($account) { } /** - * Implements hook_entity_bundles_info(). + * Implements hook_entity_bundle_info(). */ -function contact_entity_bundles_info() { - $types = array(); +function contact_entity_bundle_info() { + $bundles = array(); foreach (config_get_storage_names_with_prefix('contact.category.') as $config_name) { $config = config($config_name); - $types['contact_message'][$config->get('id')] = array( + $bundles['contact_message'][$config->get('id')] = array( 'label' => $config->get('label'), 'admin' => array( 'path' => 'admin/structure/contact/manage/%contact_category', @@ -190,7 +190,7 @@ function contact_entity_bundles_info() { ), ); } - return $types; + return $bundles; } /** diff --git a/core/modules/field/tests/modules/field_test/field_test.entity.inc b/core/modules/field/tests/modules/field_test/field_test.entity.inc index c52fd06..1f8bd4b 100644 --- a/core/modules/field/tests/modules/field_test/field_test.entity.inc +++ b/core/modules/field/tests/modules/field_test/field_test.entity.inc @@ -23,9 +23,9 @@ function field_test_entity_info_alter(&$entity_info) { } /** - * Implements hook_entity_view_modes_info_alter(). + * Implements hook_entity_view_mode_info_alter(). */ -function field_test_entity_view_modes_info_alter(&$view_modes) { +function field_test_entity_view_mode_info_alter(&$view_modes) { $entity_info = entity_get_info(); foreach ($entity_info as $entity_type => $info) { if ($entity_info[$entity_type]['module'] == 'field_test') { @@ -44,9 +44,9 @@ function field_test_entity_view_modes_info_alter(&$view_modes) { } /** - * Implements hook_entity_bundles_info_alter(). + * Implements hook_entity_bundle_info_alter(). */ -function field_test_entity_bundles_info_alter(&$bundles) { +function field_test_entity_bundle_info_alter(&$bundles) { $entity_info = entity_get_info(); foreach ($bundles as $entity_type => $info) { if ($entity_info[$entity_type]['module'] == 'field_test') { diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module index 5cda160..03094dd 100644 --- a/core/modules/field/tests/modules/field_test/field_test.module +++ b/core/modules/field/tests/modules/field_test/field_test.module @@ -308,7 +308,7 @@ function field_test_field_extra_fields_alter(&$info) { * @todo Remove when http://drupal.org/node/1822458 is fixed. */ function field_test_module_implements_alter(&$implementations, $hook) { - if ($hook == 'entity_bundles_info_alter' && isset($implementations['field_test']) && isset($implementations['rdf'])) { + if ($hook == 'entity_bundle_info_alter' && isset($implementations['field_test']) && isset($implementations['rdf'])) { foreach (array('field_test', 'rdf') as $module) { $group = $implementations[$module]; unset($implementations[$module]); diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 1bd4e6e..913f75a 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -90,15 +90,13 @@ function file_element_info() { } /** - * Implements hook_entity_view_modes_info(). + * Implements hook_entity_view_mode_info(). */ -function file_entity_view_modes_info() { - $info = array(); - $info['file']['full'] = array( +function file_entity_view_mode_info() { + $view_modes['file']['full'] = array( 'label' => t('File default'), - 'custom_settings' => FALSE, ); - return $info; + return $view_modes; } /** diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index f05f8a2..ce8397d 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -217,9 +217,9 @@ function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) { } /** - * Implements hook_entity_bundles_info_alter(). + * Implements hook_entity_bundle_info_alter(). */ -function forum_entity_bundles_info_alter(&$bundles) { +function forum_entity_bundle_info_alter(&$bundles) { // Take over URI construction for taxonomy terms that are forums. if ($vid = config('forum.settings')->get('vocabulary')) { if (isset($bundles['taxonomy_term'][$vid])) { diff --git a/core/modules/node/node.module b/core/modules/node/node.module index c0f2b99..bd4bd64 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -185,47 +185,42 @@ function node_entity_info_alter(&$info) { } /** - * Implements hook_entity_view_modes_info(). + * Implements hook_entity_view_mode_info(). */ -function node_entity_view_modes_info() { - $info = array(); - $info['node']['full'] = array( +function node_entity_view_mode_info() { + $view_modes['node']['full'] = array( 'label' => t('Full content'), - 'custom_settings' => FALSE, ); - $info['node']['teaser'] = array( + $view_modes['node']['teaser'] = array( 'label' => t('Teaser'), 'custom_settings' => TRUE, ); - $info['node']['rss'] = array( + $view_modes['node']['rss'] = array( 'label' => t('RSS'), - 'custom_settings' => FALSE, ); // 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']['search_index'] = array( + $view_modes['node']['search_index'] = array( 'label' => t('Search index'), - 'custom_settings' => FALSE, ); - $info['node']['search_result'] = array( + $view_modes['node']['search_result'] = array( 'label' => t('Search result'), - 'custom_settings' => FALSE, ); } - return $info; + return $view_modes; } /** - * Implements hook_entity_bundles_info(). + * Implements hook_entity_bundle_info(). */ -function node_entity_bundles_info() { - $info = array(); +function node_entity_bundle_info() { + $bundles = array(); // 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(); foreach (node_type_get_names() as $type => $name) { - $info['node'][$type] = array( + $bundles['node'][$type] = array( 'label' => $name, 'admin' => array( 'path' => 'admin/structure/types/manage/%node_type', @@ -234,7 +229,7 @@ function node_entity_bundles_info() { ), ); } - return $info; + return $bundles; } /** diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 816da7a..8f41a85 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -368,7 +368,7 @@ function rdf_modules_uninstalled($modules) { } /** - * Implements hook_entity_bundles_info_alter(). + * Implements hook_entity_bundle_info_alter(). * * Adds the proper RDF mapping to each entity type/bundle pair. * @@ -379,7 +379,7 @@ function rdf_modules_uninstalled($modules) { * would override the user defined mapping as well. * */ -function rdf_entity_bundles_info_alter(&$bundles) { +function rdf_entity_bundle_info_alter(&$bundles) { // Loop through each entity type and its bundles. foreach ($bundles as $entity_type => $bundle_info) { $bundle_names = array_keys($bundle_info); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index c77f4af..16d1019 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -106,29 +106,26 @@ function taxonomy_permission() { } /** - * Implements hook_entity_view_modes_info(). + * Implements hook_entity_view_mode_info(). */ -function taxonomy_entity_view_modes_info() { - $info = array(); - $info['taxonomy_term']['full'] = array( +function taxonomy_entity_view_mode_info() { + $view_modes['taxonomy_term']['full'] = array( 'label' => t('Taxonomy term page'), - 'custom_settings' => FALSE, ); - $info['taxonomy_vocabulary']['full'] = array( + $view_modes['taxonomy_vocabulary']['full'] = array( 'label' => t('Taxonomy vocabulary'), - 'custom_settings' => FALSE, ); - return $info; + return $view_modes; } /** - * Implements hook_entity_bundles_info(). + * Implements hook_entity_bundle_info(). */ -function taxonomy_entity_bundles_info() { - $info = array(); +function taxonomy_entity_bundle_info() { + $bundles = array(); foreach (taxonomy_vocabulary_get_names() as $id) { $config = config('taxonomy.vocabulary.' . $id); - $info['taxonomy_term'][$id] = array( + $bundles['taxonomy_term'][$id] = array( 'label' => $config->get('name'), 'admin' => array( 'path' => 'admin/structure/taxonomy/%taxonomy_vocabulary', @@ -137,7 +134,7 @@ function taxonomy_entity_bundles_info() { ), ); } - return $info; + return $bundles; } /** diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 2ee4de5..7eb634a 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -124,33 +124,30 @@ function user_page_build(&$page) { } /** - * Implements hook_entity_view_modes_info(). + * Implements hook_entity_view_mode_info(). */ -function user_entity_view_modes_info() { - $info = array(); - $info['user']['full'] = array( +function user_entity_view_mode_info() { + $view_modes['user']['full'] = array( 'label' => t('User account'), - 'custom_settings' => FALSE, ); - $info['user']['compact'] = array( + $view_modes['user']['compact'] = array( 'label' => t('Compact'), 'custom_settings' => TRUE, ); - return $info; + return $view_modes; } /** - * Implements hook_entity_bundles_info(). + * Implements hook_entity_bundle_info(). */ -function user_entity_bundles_info() { - $info = array(); - $info['user']['user'] = array( +function user_entity_bundle_info() { + $bundles['user']['user'] = array( 'label' => t('User'), 'admin' => array( 'path' => 'admin/config/people/accounts', ), ); - return $info; + return $bundles; } /**