summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-01-23 23:28:50 -0800
committerwebchick2014-01-23 23:28:50 -0800
commit7ab517f9efd95f953ef698bf9e661362a7bb0c71 (patch)
tree325008b1923607fb8020baeff0be9250adc1ca9b
parentb3ce6ea2f4b479cddb03e2c9afe1f0b1c6725553 (diff)
Issue #2177971 by chr.fritsch, Berdir: Remove bundle_keys annotation and related methods.
-rw-r--r--core/lib/Drupal/Core/Entity/EntityType.php28
-rw-r--r--core/lib/Drupal/Core/Entity/EntityTypeInterface.php23
-rw-r--r--core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php3
-rw-r--r--core/modules/comment/lib/Drupal/comment/Entity/Comment.php3
-rw-r--r--core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationFieldInstanceListController.php2
-rw-r--r--core/modules/contact/lib/Drupal/contact/Entity/Message.php3
-rw-r--r--core/modules/field/field.module23
-rw-r--r--core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php3
-rw-r--r--core/modules/node/lib/Drupal/node/Entity/Node.php3
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php3
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php4
11 files changed, 3 insertions, 95 deletions
diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php
index 64e25d8..b4fe29c 100644
--- a/core/lib/Drupal/Core/Entity/EntityType.php
+++ b/core/lib/Drupal/Core/Entity/EntityType.php
@@ -87,20 +87,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.
*
* @var bool (optional)
@@ -459,20 +445,6 @@ class EntityType implements EntityTypeInterface {
/**
* {@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}
- */
public function isFieldable() {
return isset($this->fieldable) ? $this->fieldable : FALSE;
}
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
index f1da8c8..5d390be 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
@@ -370,29 +370,6 @@ interface EntityTypeInterface {
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.
*
* @return bool
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 4c900da..643fa33 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 @@ use Drupal\custom_block\CustomBlockInterface;
* "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 3c8b696..6bcfd95 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 @@ use Drupal\Core\TypedData\DataDefinition;
* "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 736aee9..b708ded 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 @@ class ConfigTranslationFieldInstanceListController extends ConfigTranslationEnti
*/
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 b8a1523..573b304 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 @@ use Drupal\Core\Field\FieldDefinition;
* },
* 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 408d816..f7081e9 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -472,29 +472,6 @@ function field_view_field(ContentEntityInterface $entity, $field_name, $display_
}
/**
- * 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().
*/
function field_page_build(&$page) {
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 e467268..36362c8 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 @@ use Symfony\Component\Routing\Route;
* "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 90d4fac..0d4683e 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 @@ use Drupal\node\NodeInterface;
* "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 bf85ab8..b28a6d9 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 @@ use Drupal\taxonomy\TermInterface;
* "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 8de866c..32f6414 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 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface {
$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 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface {
$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.