Commit bf3e9cfa authored by alexpott's avatar alexpott
Browse files

Issue #2112705 by mikey_p: Replace EntityType::$module with provider.

parent 97fc3d31
......@@ -191,26 +191,6 @@ function config_context_leave() {
->leaveContext();
}
/**
* Return a list of all config entity types provided by a module.
*
* @param string $module
* The name of the module possibly providing config entities.
*
* @return array
* An associative array containing the entity info for any config entities
* provided by the requested module, keyed by the entity type.
*/
function config_get_module_config_entities($module) {
// While this is a lot of work to generate, it's not worth static caching
// since this function is only called at install/uninstall, and only
// once per module.
$info = entity_get_info();
return array_filter($info, function($entity_info) use ($module) {
return ($entity_info['module'] == $module) && is_subclass_of($entity_info['class'], 'Drupal\Core\Config\Entity\ConfigEntityInterface');
});
}
/**
* Returns the entity type of a configuration object.
*
......
......@@ -16,13 +16,6 @@
*/
class EntityType extends Plugin {
/**
* The name of the module providing the type.
*
* @var string
*/
public $module;
/**
* The name of the entity type class.
*
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "aggregator_feed",
* label = @Translation("Aggregator feed"),
* module = "aggregator",
* controllers = {
* "storage" = "Drupal\aggregator\FeedStorageController",
* "view_builder" = "Drupal\aggregator\FeedViewBuilder",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "aggregator_item",
* label = @Translation("Aggregator feed item"),
* module = "aggregator",
* controllers = {
* "storage" = "Drupal\aggregator\ItemStorageController",
* "view_builder" = "Drupal\aggregator\ItemViewBuilder"
......
......@@ -20,7 +20,6 @@
* id = "custom_block",
* label = @Translation("Custom Block"),
* bundle_label = @Translation("Custom Block type"),
* module = "custom_block",
* controllers = {
* "storage" = "Drupal\custom_block\CustomBlockStorageController",
* "access" = "Drupal\custom_block\CustomBlockAccessController",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "custom_block_type",
* label = @Translation("Custom block type"),
* module = "custom_block",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "form" = {
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "block",
* label = @Translation("Block"),
* module = "block",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "access" = "Drupal\block\BlockAccessController",
......
......@@ -23,7 +23,6 @@
* @EntityType(
* id = "breakpoint",
* label = @Translation("Breakpoint"),
* module = "breakpoint",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
* },
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "breakpoint_group",
* label = @Translation("Breakpoint group"),
* module = "breakpoint",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
* },
......
......@@ -21,7 +21,6 @@
* id = "comment",
* label = @Translation("Comment"),
* bundle_label = @Translation("Content type"),
* module = "comment",
* controllers = {
* "storage" = "Drupal\comment\CommentStorageController",
* "access" = "Drupal\comment\CommentAccessController",
......
......@@ -16,7 +16,6 @@
* @EntityType(
* id = "config_query_test",
* label = @Translation("Test configuration for query"),
* module = "config_test",
* controllers = {
* "storage" = "Drupal\config_test\ConfigTestStorageController",
* "list" = "Drupal\Core\Config\Entity\ConfigEntityListController",
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "config_test",
* label = @Translation("Test configuration"),
* module = "config_test",
* controllers = {
* "storage" = "Drupal\config_test\ConfigTestStorageController",
* "list" = "Drupal\config_test\ConfigTestListController",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "contact_category",
* label = @Translation("Contact category"),
* module = "contact",
* controllers = {
* "storage" = "Drupal\contact\CategoryStorageController",
* "access" = "Drupal\contact\CategoryAccessController",
......
......@@ -16,7 +16,6 @@
* @EntityType(
* id = "contact_message",
* label = @Translation("Contact message"),
* module = "contact",
* controllers = {
* "storage" = "Drupal\Core\Entity\FieldableDatabaseStorageController",
* "view_builder" = "Drupal\contact\MessageViewBuilder",
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "editor",
* label = @Translation("Editor"),
* module = "editor",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
* },
......
......@@ -164,7 +164,7 @@ function entity_module_preuninstall($module) {
// Clean up all entity bundles (including field instances) of every entity
// type provided by the module that is being uninstalled.
foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) {
if ($entity_info['module'] == $module) {
if ($entity_info['provider'] == $module) {
foreach (array_keys(entity_get_bundles($entity_type)) as $bundle) {
entity_invoke_bundle_hook('delete', $entity_type, $bundle);
}
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "entity_display",
* label = @Translation("Entity display"),
* module = "entity",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
* },
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "entity_form_display",
* label = @Translation("Entity form display"),
* module = "entity",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
* },
......
......@@ -32,7 +32,6 @@
* @EntityType(
* id = "form_mode",
* label = @Translation("Form mode"),
* module = "entity",
* controllers = {
* "list" = "Drupal\entity\EntityFormModeListController",
* "form" = {
......
......@@ -33,7 +33,6 @@
* @EntityType(
* id = "view_mode",
* label = @Translation("View mode"),
* module = "entity",
* controllers = {
* "list" = "Drupal\entity\EntityDisplayModeListController",
* "form" = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment