Commit bf3e9cfa authored by alexpott's avatar alexpott

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" = {
......
......@@ -22,7 +22,6 @@
* @EntityType(
* id = "field_entity",
* label = @Translation("Field"),
* module = "field",
* controllers = {
* "storage" = "Drupal\field\FieldStorageController"
* },
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "field_instance",
* label = @Translation("Field instance"),
* module = "field",
* controllers = {
* "storage" = "Drupal\field\FieldInstanceStorageController"
* },
......
......@@ -17,7 +17,6 @@
* @EntityType(
* id = "field_ui_test_no_bundle",
* label = @Translation("Test Field UI entity, no bundle"),
* module = "field_ui_test",
* controllers = {
* "storage" = "Drupal\Core\Entity\DatabaseStorageController"
* },
......
......@@ -21,7 +21,6 @@
* @EntityType(
* id = "file",
* label = @Translation("File"),
* module = "file",
* controllers = {
* "storage" = "Drupal\file\FileStorageController",
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder"
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "filter_format",
* label = @Translation("Text format"),
* module = "filter",
* controllers = {
* "form" = {
* "add" = "Drupal\filter\FilterFormatAddFormController",
......
......@@ -24,7 +24,6 @@
* @EntityType(
* id = "image_style",
* label = @Translation("Image style"),
* module = "image",
* controllers = {
* "form" = {
* "add" = "Drupal\image\Form\ImageStyleAddForm",
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "language_entity",
* label = @Translation("Language"),
* module = "language",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "list" = "Drupal\language\LanguageListController",
......
......@@ -24,7 +24,6 @@
* @EntityType(
* id = "menu_link",
* label = @Translation("Menu link"),
* module = "menu_link",
* controllers = {
* "storage" = "Drupal\menu_link\MenuLinkStorageController",
* "access" = "Drupal\menu_link\MenuLinkAccessController",
......
......@@ -20,7 +20,6 @@
* id = "node",
* label = @Translation("Content"),
* bundle_label = @Translation("Content type"),
* module = "node",
* controllers = {
* "storage" = "Drupal\node\NodeStorageController",
* "view_builder" = "Drupal\node\NodeViewBuilder",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "node_type",
* label = @Translation("Content type"),
* module = "node",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "access" = "Drupal\node\NodeTypeAccessController",
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "picture_mapping",
* label = @Translation("Picture mapping"),
* module = "picture",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "list" = "Drupal\picture\PictureMappingListController",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "rdf_mapping",
* label = @Translation("RDF mapping"),
* module = "rdf",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController"
* },
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "shortcut_set",
* label = @Translation("Shortcut set"),
* module = "shortcut",
* controllers = {
* "storage" = "Drupal\shortcut\ShortcutSetStorageController",
* "access" = "Drupal\shortcut\ShortcutSetAccessController",
......
......@@ -21,7 +21,6 @@
* @EntityType(
* id = "action",
* label = @Translation("Action"),
* module = "system",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* },
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "date_format",
* label = @Translation("Date format"),
* module = "system",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "access" = "Drupal\system\DateFormatAccessController",
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "menu",
* label = @Translation("Menu"),
* module = "system",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "access" = "Drupal\system\MenuAccessController"
......
......@@ -19,8 +19,7 @@
* label = @Translation("Entity cache test"),
* controllers = {
* "storage" = "Drupal\Core\Entity\DatabaseStorageController",
* },
* module = "entity_cache_test_dependency"
* }
* )
*/
class EntityCacheTest extends Entity {
......
......@@ -147,7 +147,7 @@ function entity_test_entity_bundle_info() {
$bundles = array();
$entity_info = entity_get_info();
foreach ($entity_info as $entity_type => $info) {
if ($info['module'] == 'entity_test') {
if ($info['provider'] == 'entity_test') {
$bundles[$entity_type] = \Drupal::state()->get($entity_type . '.bundles') ?: array($entity_type => array('label' => 'Entity Test Bundle'));
}
}
......@@ -160,7 +160,7 @@ function entity_test_entity_bundle_info() {
function entity_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'] == 'entity_test' && !isset($view_modes[$entity_type])) {
if ($entity_info[$entity_type]['provider'] == 'entity_test' && !isset($view_modes[$entity_type])) {
$view_modes[$entity_type] = array(
'full' => array(
'label' => t('Full object'),
......@@ -183,7 +183,7 @@ function entity_test_entity_view_mode_info_alter(&$view_modes) {
function entity_test_entity_form_mode_info_alter(&$form_modes) {
$entity_info = entity_get_info();
foreach ($entity_info as $entity_type => $info) {
if ($entity_info[$entity_type]['module'] == 'entity_test') {
if ($entity_info[$entity_type]['provider'] == 'entity_test') {
$form_modes[$entity_type] = array(
'compact' => array(
'label' => t('Compact version'),
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "entity_test",
* label = @Translation("Test entity"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController",
* "list" = "Drupal\entity_test\EntityTestListController",
......
......@@ -17,7 +17,6 @@
* @EntityType(
* id = "entity_test_cache",
* label = @Translation("Test entity with field cache"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController",
* "access" = "Drupal\entity_test\EntityTestAccessController",
......
......@@ -16,7 +16,6 @@
* @EntityType(
* id = "entity_test_default_access",
* label = @Translation("Test entity with default access"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController"
* },
......
......@@ -16,7 +16,6 @@
* @EntityType(
* id = "entity_test_label",
* label = @Translation("Entity Test label"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController",
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder"
......
......@@ -16,7 +16,6 @@
* @EntityType(
* id = "entity_test_label_callback",
* label = @Translation("Entity test label callback"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController"
* },
......
......@@ -17,7 +17,6 @@
* @EntityType(
* id = "entity_test_mul",
* label = @Translation("Test entity - data table"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController",
* "access" = "Drupal\entity_test\EntityTestAccessController",
......
......@@ -17,7 +17,6 @@
* @EntityType(
* id = "entity_test_mulrev",
* label = @Translation("Test entity - revisions and data table"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController",
* "access" = "Drupal\entity_test\EntityTestAccessController",
......
......@@ -16,7 +16,6 @@
* @EntityType(
* id = "entity_test_no_label",
* label = @Translation("Entity Test without label"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController"
* },
......
......@@ -17,7 +17,6 @@
* @EntityType(
* id = "entity_test_rev",
* label = @Translation("Test entity - revisions"),
* module = "entity_test",
* controllers = {
* "storage" = "Drupal\entity_test\EntityTestStorageController",
* "access" = "Drupal\entity_test\EntityTestAccessController",
......
......@@ -21,7 +21,6 @@
* id = "taxonomy_term",
* label = @Translation("Taxonomy term"),
* bundle_label = @Translation("Vocabulary"),
* module = "taxonomy",
* controllers = {
* "storage" = "Drupal\taxonomy\TermStorageController",
* "view_builder" = "Drupal\taxonomy\TermViewBuilder",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "taxonomy_vocabulary",
* label = @Translation("Taxonomy vocabulary"),
* module = "taxonomy",
* controllers = {
* "storage" = "Drupal\taxonomy\VocabularyStorageController",
* "list" = "Drupal\taxonomy\VocabularyListController",
......
......@@ -19,7 +19,6 @@
* @EntityType(
* id = "tour",
* label = @Translation("Tour"),
* module = "tour",
* controllers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
* "view_builder" = "Drupal\tour\TourViewBuilder"
......
......@@ -17,7 +17,6 @@
* @EntityType(
* id = "user_role",
* label = @Translation("Role"),
* module = "user",
* controllers = {
* "storage" = "Drupal\user\RoleStorageController",
* "access" = "Drupal\user\RoleAccessController",
......
......@@ -18,7 +18,6 @@
* @EntityType(
* id = "user",
* label = @Translation("User"),
* module = "user",
* controllers = {
* "storage" = "Drupal\user\UserStorageController",
* "access" = "Drupal\user\UserAccessController",
......
......@@ -20,7 +20,6 @@
* @EntityType(
* id = "view",
* label = @Translation("View"),
* module = "views",
* controllers = {
* "storage" = "Drupal\views\ViewStorageController",
* "access" = "Drupal\views\ViewAccessController"
......
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