diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 64e25d87680e69bf6a5f3b43c4e4bc9bf57444c6..b4fe29c3928d4c7a241a5835ef7e04869b39df4b 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -86,20 +86,6 @@ class EntityType implements EntityTypeInterface { */ protected $permission_granularity; - /** - * An array describing how the Field API can extract the information it needs - * from the bundle objects for this type (e.g Vocabulary objects for terms; - * not applicable for nodes): - * - bundle: The name of the property that contains the name of the bundle - * object. - * - * This entry can be omitted if this type's bundles do not exist as standalone - * objects. - * - * @var array - */ - protected $bundle_keys = array(); - /** * Indicates whether fields can be attached to entities of this type. * @@ -456,20 +442,6 @@ public function getPermissionGranularity() { return isset($this->permission_granularity) ? $this->permission_granularity : 'entity_type'; } - /** - * {@inheritdoc} - */ - public function getBundleKeys() { - return isset($this->bundle_keys) ? $this->bundle_keys : array(); - } - - /** - * {@inheritdoc} - */ - public function getBundleKey($name) { - return isset($this->bundle_keys[$name]) ? $this->bundle_keys[$name] : FALSE; - } - /** * {@inheritdoc} */ diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index f1da8c82da90bcf7989a9c73884f4c8c40bd7c89..5d390be599c73ae6bb404073a84850654cfbe213 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -369,29 +369,6 @@ public function getAdminPermission(); */ public function getPermissionGranularity(); - /** - * Get all bundle keys defined on the annotation. - * - * @return array - * An array describing how the Field API can extract the information it - * needs from the bundle objects for this type (e.g Vocabulary objects for - * terms; not applicable for nodes): - * - bundle: The name of the property that contains the name of the bundle - * object. - */ - public function getBundleKeys(); - - /** - * Returns a single bundle key. - * - * @param string $name - * The name of the bundle key. - * - * @return string|bool - * The value of the bundle key. - */ - public function getBundleKey($name); - /** * Indicates whether fields can be attached to entities of this type. * diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php index 4c900daaa6eab813a3438f2de353c90c2cfc39ea..643fa335673731d4aca5f19707d28daf34ae8403 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php @@ -49,9 +49,6 @@ * "label" = "info", * "uuid" = "uuid" * }, - * bundle_keys = { - * "bundle" = "type" - * }, * bundle_entity_type = "custom_block_type" * ) */ diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php index 3c8b696cc6e9425655e7eceb9c02cc450716bc4b..6bcfd954dc19e4421dfb8a38f07ef63b4d2b0ee1 100644 --- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php @@ -43,9 +43,6 @@ * "label" = "subject", * "uuid" = "uuid" * }, - * bundle_keys = { - * "bundle" = "field_id" - * }, * links = { * "canonical" = "comment.permalink", * "edit-form" = "comment.edit_page", diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php index 736aee99b307966877bed921ef2ed3415e3b28c6..b708ded078ea254cb31aa24efeed9418faf5dd74 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php @@ -152,7 +152,7 @@ public function buildHeader() { */ public function displayBundle() { // The bundle key is explicitly defined in the entity definition. - if ($this->baseEntityInfo->getBundleKey('bundle')) { + if ($this->baseEntityInfo->getKey('bundle')) { return TRUE; } diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Message.php b/core/modules/contact/lib/Drupal/contact/Entity/Message.php index b8a1523c12df3dc9f7b4032311e0e9d934db4e25..573b3041c780a1eefc55a98c50e3715a1042aa3c 100644 --- a/core/modules/contact/lib/Drupal/contact/Entity/Message.php +++ b/core/modules/contact/lib/Drupal/contact/Entity/Message.php @@ -29,9 +29,6 @@ * }, * bundle_entity_type = "contact_category", * fieldable = TRUE, - * bundle_keys = { - * "bundle" = "id" - * }, * links = { * "admin-form" = "contact.category_edit" * } diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 408d816656f5484283a0cdf6e3cf9614f2310144..f7081e9c2483dffd0de70e955fe3957eae92e9de 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -471,29 +471,6 @@ function field_view_field(ContentEntityInterface $entity, $field_name, $display_ return $output; } -/** - * Extracts the bundle name from a bundle object. - * - * @param $entity_type - * The type of $entity; e.g., 'node' or 'user'. - * @param $bundle - * The bundle object (or string if bundles for this entity type do not exist - * as standalone objects). - * - * @return - * The bundle name. - */ -function field_extract_bundle($entity_type, $bundle) { - if (is_string($bundle)) { - return $bundle; - } - - $info = \Drupal::entityManager()->getDefinition($entity_type); - if (is_object($bundle) && ($bundle_key = $info->getBundleKey('bundle')) && isset($bundle->{$bundle_key})) { - return $bundle->{$bundle_key}; - } -} - /** * Implements hook_page_build(). */ diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php index e4672685b6c3abf98a9026f057ba88a17aa1bfa9..36362c8b3a1af38b635e5d60a365805bbcca213a 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php @@ -37,9 +37,6 @@ * "uuid" = "uuid", * "bundle" = "bundle" * }, - * bundle_keys = { - * "bundle" = "bundle" - * } * ) */ class MenuLink extends Entity implements \ArrayAccess, MenuLinkInterface { diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php index 90d4fac4b9ae5dff4572fb927f32d57ca9050e6f..0d4683ec400270629e38190a3feb8d900b1e1d24 100644 --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -48,9 +48,6 @@ * "label" = "title", * "uuid" = "uuid" * }, - * bundle_keys = { - * "bundle" = "type" - * }, * bundle_entity_type = "node_type", * permission_granularity = "bundle", * links = { diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php index bf85ab866769199e7024e0ef6c837f13265a91bc..b28a6d918c70504ce5967637ae7048f80605c9ed 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php @@ -41,9 +41,6 @@ * "label" = "name", * "uuid" = "uuid" * }, - * bundle_keys = { - * "bundle" = "vid" - * }, * bundle_entity_type = "taxonomy_vocabulary", * links = { * "canonical" = "taxonomy.term_page", diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php index 8de866ca05fa1ee97c245e234813f611ca023832..32f6414bbe5b8f186f812fdd5a8b5f2f648a3068 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php @@ -563,7 +563,7 @@ protected function buildFilters(&$form, &$form_state) { $bundles = entity_get_bundles($this->entity_type); // If the current base table support bundles and has more than one (like user). - if (!empty($bundles) && $this->entity_info && $this->entity_info->getBundleKeys()) { + if (!empty($bundles) && $this->entity_info) { // Get all bundles and their human readable names. $options = array('all' => t('All')); foreach ($bundles as $type => $bundle) { @@ -837,7 +837,7 @@ protected function defaultDisplayFiltersUser(array $form, array &$form_state) { $filters = array(); if (!empty($form_state['values']['show']['type']) && $form_state['values']['show']['type'] != 'all') { - $bundle_key = $this->entity_info->getBundleKey('bundle'); + $bundle_key = $this->entity_info->getKey('bundle'); // Figure out the table where $bundle_key lives. It may not be the same as // the base table for the view; the taxonomy vocabulary machine_name, for // example, is stored in taxonomy_vocabulary, not taxonomy_term_data.