From 342ea113b84e8d1d04fe94e6ee1bb5886d6f5edc Mon Sep 17 00:00:00 2001
From: Kristiaan Van den Eynde <magentix@gmail.com>
Date: Tue, 16 Aug 2022 10:52:36 +0200
Subject: [PATCH] Issue #3303321 by kristiaanvandeneynde: Drop 2.0.x upgrade
 path and update machine names

---
 config/optional/views.view.group_members.yml     |  4 ++--
 config/schema/group.views.schema.yml             |  8 ++++----
 group.views.inc                                  |  4 ++--
 .../config/optional/views.view.group_nodes.yml   | 12 ++++++------
 src/Entity/Views/GroupRelationshipViewsData.php  |  4 ++--
 src/Entity/Views/GroupViewsData.php              |  4 ++--
 .../relationship/GroupRelationshipToEntity.php   |  2 +-
 .../GroupRelationshipToEntityBase.php            |  8 ++++----
 .../GroupRelationshipToEntityReverse.php         |  2 +-
 .../relationship/GroupToGroupRelationship.php    | 10 +++++-----
 ...roup_relationship_to_entity_relationship.yml} | 10 +++++-----
 ...ationship_to_entity_reverse_relationship.yml} | 16 ++++++++--------
 ...group_to_group_relationship_relationship.yml} | 16 ++++++++--------
 ...GroupRelationshipToEntityRelationshipTest.php |  4 ++--
 ...lationshipToEntityReverseRelationshipTest.php |  4 ++--
 .../GroupToGroupRelationshipRelationshipTest.php |  4 ++--
 16 files changed, 56 insertions(+), 56 deletions(-)
 rename tests/modules/group_test_views/test_views/{views.view.test_group_content_to_entity_relationship.yml => views.view.test_group_relationship_to_entity_relationship.yml} (96%)
 rename tests/modules/group_test_views/test_views/{views.view.test_group_content_to_entity_reverse_relationship.yml => views.view.test_group_relationship_to_entity_reverse_relationship.yml} (94%)
 rename tests/modules/group_test_views/test_views/{views.view.test_group_to_group_content_relationship.yml => views.view.test_group_to_group_relationship_relationship.yml} (94%)

diff --git a/config/optional/views.view.group_members.yml b/config/optional/views.view.group_members.yml
index 24f6900c..c8ea60fe 100644
--- a/config/optional/views.view.group_members.yml
+++ b/config/optional/views.view.group_members.yml
@@ -652,9 +652,9 @@ display:
           group_type: group
           admin_label: 'Member account'
           required: true
-          group_content_plugins:
+          group_relation_plugins:
             group_membership: group_membership
-          plugin_id: group_content_to_entity
+          plugin_id: group_relationship_to_entity
           entity_type: group_relationship
       arguments:
         gid:
diff --git a/config/schema/group.views.schema.yml b/config/schema/group.views.schema.yml
index 597d759e..598f096c 100644
--- a/config/schema/group.views.schema.yml
+++ b/config/schema/group.views.schema.yml
@@ -26,21 +26,21 @@ views.argument_default.group_id_from_url:
 views_relationship_with_group_plugin_filter:
   type: 'views_relationship'
   mapping:
-    group_content_plugins:
+    group_relation_plugins:
       type: 'sequence'
       label: 'Group relation plugins'
       sequence:
         type: 'string'
         label: 'Group relation plugin ID'
 
-views.relationship.group_content_to_entity:
+views.relationship.group_relationship_to_entity:
   type: 'views_relationship_with_group_plugin_filter'
   label: 'Group relationship to entity reference'
 
-views.relationship.group_content_to_entity_reverse:
+views.relationship.group_relationship_to_entity_reverse:
   type: 'views_relationship_with_group_plugin_filter'
   label: 'Reverse group relationship to entity reference'
 
-views.relationship.group_to_group_content:
+views.relationship.group_to_group_relationship:
   type: 'views_relationship_with_group_plugin_filter'
   label: 'Group to group relationship'
diff --git a/group.views.inc b/group.views.inc
index 4b48c357..9b60a88c 100644
--- a/group.views.inc
+++ b/group.views.inc
@@ -43,7 +43,7 @@ function group_views_data_alter(array &$data) {
 
     // This relationship will allow a content entity to easily map to the group
     // content entity that ties it to a group, optionally filtering by plugin.
-    $data[$entity_data_table]['group_content'] = [
+    $data[$entity_data_table]['group_relationship'] = [
       'title' => t('Group relationship for @entity_type', $t_args),
       'help' => t('Relates to the group relationship entities that represent the @entity_type.', $t_args),
       'relationship' => [
@@ -51,7 +51,7 @@ function group_views_data_alter(array &$data) {
         'base' => $data_table,
         'base field' => 'entity_id',
         'relationship field' => $entity_type->getKey('id'),
-        'id' => 'group_content_to_entity_reverse',
+        'id' => 'group_relationship_to_entity_reverse',
         'label' => t('@entity_type group relationship', $t_args),
       ],
     ];
diff --git a/modules/gnode/config/optional/views.view.group_nodes.yml b/modules/gnode/config/optional/views.view.group_nodes.yml
index 83c35e79..80620397 100644
--- a/modules/gnode/config/optional/views.view.group_nodes.yml
+++ b/modules/gnode/config/optional/views.view.group_nodes.yml
@@ -858,23 +858,23 @@ display:
           content: 'No content available.'
           plugin_id: text_custom
       relationships:
-        group_content:
-          id: group_content
+        group_relationship:
+          id: group_relationship
           table: node_field_data
-          field: group_content
+          field: group_relationship
           relationship: none
           group_type: group
           admin_label: 'Content relation'
           required: true
-          group_content_plugins: {  }
+          group_relation_plugins: {  }
           entity_type: node
-          plugin_id: group_content_to_entity_reverse
+          plugin_id: group_relationship_to_entity_reverse
       arguments:
         gid:
           id: gid
           table: group_relationship_field_data
           field: gid
-          relationship: group_content
+          relationship: group_relationship
           group_type: group
           admin_label: ''
           default_action: 'access denied'
diff --git a/src/Entity/Views/GroupRelationshipViewsData.php b/src/Entity/Views/GroupRelationshipViewsData.php
index 7a5a0770..e44f5551 100644
--- a/src/Entity/Views/GroupRelationshipViewsData.php
+++ b/src/Entity/Views/GroupRelationshipViewsData.php
@@ -65,7 +65,7 @@ class GroupRelationshipViewsData extends EntityViewsData {
       // Create a unique field name for this views field.
       $field_name = 'gc__' . $entity_type_id;
 
-      // We only add one 'group_content' relationship per entity type.
+      // We only add one 'group_relationship' relationship per entity type.
       if (isset($data[$entity_data_table][$field_name])) {
         continue;
       }
@@ -84,7 +84,7 @@ class GroupRelationshipViewsData extends EntityViewsData {
           'base' => $entity_data_table,
           'base field' => $entity_type->getKey('id'),
           'relationship field' => 'entity_id',
-          'id' => 'group_content_to_entity',
+          'id' => 'group_relationship_to_entity',
           'label' => $this->t('Group relationship @entity_type', $t_args),
           'target_entity_type' => $entity_type_id,
         ],
diff --git a/src/Entity/Views/GroupViewsData.php b/src/Entity/Views/GroupViewsData.php
index 6a971f78..3d225823 100644
--- a/src/Entity/Views/GroupViewsData.php
+++ b/src/Entity/Views/GroupViewsData.php
@@ -21,10 +21,10 @@ class GroupViewsData extends EntityViewsData {
       'numeric' => TRUE,
     ];
 
-    $data['groups_field_data']['group_content_id']['relationship'] = [
+    $data['groups_field_data']['group_relationship_id']['relationship'] = [
       'title' => $this->t('Group relationship'),
       'help' => $this->t('Relate to the group relationship entities. From there you can relate to the actual grouped entities.'),
-      'id' => 'group_to_group_content',
+      'id' => 'group_to_group_relationship',
       'base' => 'group_relationship_field_data',
       'base field' => 'gid',
       'field' => 'id',
diff --git a/src/Plugin/views/relationship/GroupRelationshipToEntity.php b/src/Plugin/views/relationship/GroupRelationshipToEntity.php
index 2fb87668..8a76ad00 100644
--- a/src/Plugin/views/relationship/GroupRelationshipToEntity.php
+++ b/src/Plugin/views/relationship/GroupRelationshipToEntity.php
@@ -10,7 +10,7 @@ namespace Drupal\group\Plugin\views\relationship;
  *
  * @ingroup views_relationship_handlers
  *
- * @ViewsRelationship("group_content_to_entity")
+ * @ViewsRelationship("group_relationship_to_entity")
  */
 class GroupRelationshipToEntity extends GroupRelationshipToEntityBase {
 
diff --git a/src/Plugin/views/relationship/GroupRelationshipToEntityBase.php b/src/Plugin/views/relationship/GroupRelationshipToEntityBase.php
index 4667b92c..36bd1cdd 100644
--- a/src/Plugin/views/relationship/GroupRelationshipToEntityBase.php
+++ b/src/Plugin/views/relationship/GroupRelationshipToEntityBase.php
@@ -81,7 +81,7 @@ abstract class GroupRelationshipToEntityBase extends RelationshipPluginBase {
    */
   protected function defineOptions() {
     $options = parent::defineOptions();
-    $options['group_content_plugins']['default'] = [];
+    $options['group_relation_plugins']['default'] = [];
     return $options;
   }
 
@@ -100,13 +100,13 @@ abstract class GroupRelationshipToEntityBase extends RelationshipPluginBase {
       }
     }
 
-    $form['group_content_plugins'] = [
+    $form['group_relation_plugins'] = [
       '#type' => 'checkboxes',
       '#title' => $this->t('Filter by plugin'),
       '#description' => $this->t('Refine the result by plugin. Leave empty to select all plugins, including those that could be added after this relationship was configured.'),
       '#options' => $options,
       '#weight' => -2,
-      '#default_value' => $this->options['group_content_plugins'],
+      '#default_value' => $this->options['group_relation_plugins'],
     ];
   }
 
@@ -135,7 +135,7 @@ abstract class GroupRelationshipToEntityBase extends RelationshipPluginBase {
     }
 
     // Add the plugin IDs to the query if any were selected.
-    $plugin_ids = array_filter($this->options['group_content_plugins']);
+    $plugin_ids = array_filter($this->options['group_relation_plugins']);
     if (!empty($plugin_ids)) {
       $def['extra'][] = [
         $this->getJoinFieldType() => 'plugin_id',
diff --git a/src/Plugin/views/relationship/GroupRelationshipToEntityReverse.php b/src/Plugin/views/relationship/GroupRelationshipToEntityReverse.php
index 3edd5366..f75c9cdc 100644
--- a/src/Plugin/views/relationship/GroupRelationshipToEntityReverse.php
+++ b/src/Plugin/views/relationship/GroupRelationshipToEntityReverse.php
@@ -7,7 +7,7 @@ namespace Drupal\group\Plugin\views\relationship;
  *
  * @ingroup views_relationship_handlers
  *
- * @ViewsRelationship("group_content_to_entity_reverse")
+ * @ViewsRelationship("group_relationship_to_entity_reverse")
  */
 class GroupRelationshipToEntityReverse extends GroupRelationshipToEntityBase {
 
diff --git a/src/Plugin/views/relationship/GroupToGroupRelationship.php b/src/Plugin/views/relationship/GroupToGroupRelationship.php
index a1acb969..3a3a3a10 100644
--- a/src/Plugin/views/relationship/GroupToGroupRelationship.php
+++ b/src/Plugin/views/relationship/GroupToGroupRelationship.php
@@ -14,7 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  *
  * @ingroup views_relationship_handlers
  *
- * @ViewsRelationship("group_to_group_content")
+ * @ViewsRelationship("group_to_group_relationship")
  */
 class GroupToGroupRelationship extends RelationshipPluginBase {
 
@@ -64,7 +64,7 @@ class GroupToGroupRelationship extends RelationshipPluginBase {
    */
   protected function defineOptions() {
     $options = parent::defineOptions();
-    $options['group_content_plugins']['default'] = [];
+    $options['group_relation_plugins']['default'] = [];
     return $options;
   }
 
@@ -74,13 +74,13 @@ class GroupToGroupRelationship extends RelationshipPluginBase {
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
 
-    $form['group_content_plugins'] = [
+    $form['group_relation_plugins'] = [
       '#type' => 'checkboxes',
       '#title' => $this->t('Filter by plugin'),
       '#description' => $this->t('Refine the result by plugin. Leave empty to select all plugins, including those that could be added after this relationship was configured.'),
       '#options' => $this->getPluginOptions(),
       '#weight' => -2,
-      '#default_value' => $this->options['group_content_plugins'],
+      '#default_value' => $this->options['group_relation_plugins'],
     ];
   }
 
@@ -124,7 +124,7 @@ class GroupToGroupRelationship extends RelationshipPluginBase {
     }
 
     // Add the plugin IDs to the query if any were selected.
-    $plugin_ids = array_filter($this->options['group_content_plugins']);
+    $plugin_ids = array_filter($this->options['group_relation_plugins']);
     if (!empty($plugin_ids)) {
       $def['extra'][] = [
         'field' => 'plugin_id',
diff --git a/tests/modules/group_test_views/test_views/views.view.test_group_content_to_entity_relationship.yml b/tests/modules/group_test_views/test_views/views.view.test_group_relationship_to_entity_relationship.yml
similarity index 96%
rename from tests/modules/group_test_views/test_views/views.view.test_group_content_to_entity_relationship.yml
rename to tests/modules/group_test_views/test_views/views.view.test_group_relationship_to_entity_relationship.yml
index fbfa072c..873cf913 100644
--- a/tests/modules/group_test_views/test_views/views.view.test_group_content_to_entity_relationship.yml
+++ b/tests/modules/group_test_views/test_views/views.view.test_group_relationship_to_entity_relationship.yml
@@ -4,8 +4,8 @@ dependencies:
   module:
     - group
     - user
-id: test_group_content_to_entity_relationship
-label: test_group_content_to_entity_relationship
+id: test_group_relationship_to_entity_relationship
+label: test_group_relationship_to_entity_relationship
 module: views
 description: ''
 tag: ''
@@ -208,10 +208,10 @@ display:
           group_type: group
           admin_label: 'Group relationship User'
           required: true
-          group_content_plugins:
+          group_relation_plugins:
             group_membership: group_membership
-          entity_type: group_content
-          plugin_id: group_content_to_entity
+          entity_type: group_relationship
+          plugin_id: group_relationship_to_entity
       arguments: {  }
       display_extenders: {  }
     cache_metadata:
diff --git a/tests/modules/group_test_views/test_views/views.view.test_group_content_to_entity_reverse_relationship.yml b/tests/modules/group_test_views/test_views/views.view.test_group_relationship_to_entity_reverse_relationship.yml
similarity index 94%
rename from tests/modules/group_test_views/test_views/views.view.test_group_content_to_entity_reverse_relationship.yml
rename to tests/modules/group_test_views/test_views/views.view.test_group_relationship_to_entity_reverse_relationship.yml
index c6234acb..d6d98a27 100644
--- a/tests/modules/group_test_views/test_views/views.view.test_group_content_to_entity_reverse_relationship.yml
+++ b/tests/modules/group_test_views/test_views/views.view.test_group_relationship_to_entity_reverse_relationship.yml
@@ -4,8 +4,8 @@ dependencies:
   module:
     - group
     - user
-id: test_group_content_to_entity_reverse_relationship
-label: test_group_content_to_entity_reverse_relationship
+id: test_group_relationship_to_entity_reverse_relationship
+label: test_group_relationship_to_entity_reverse_relationship
 module: views
 description: ''
 tag: ''
@@ -81,7 +81,7 @@ display:
           id: id
           table: group_relationship_field_data
           field: id
-          relationship: group_content
+          relationship: group_relationship
           group_type: group
           admin_label: ''
           label: 'Group relationship ID'
@@ -215,18 +215,18 @@ display:
       footer: {  }
       empty: {  }
       relationships:
-        group_content:
-          id: group_content
+        group_relationship:
+          id: group_relationship
           table: users_field_data
-          field: group_content
+          field: group_relationship
           relationship: none
           group_type: group
           admin_label: 'User group relationships'
           required: true
-          group_content_plugins:
+          group_relation_plugins:
             group_membership: group_membership
           entity_type: user
-          plugin_id: group_content_to_entity_reverse
+          plugin_id: group_relationship_to_entity_reverse
       arguments: {  }
       display_extenders: {  }
     cache_metadata:
diff --git a/tests/modules/group_test_views/test_views/views.view.test_group_to_group_content_relationship.yml b/tests/modules/group_test_views/test_views/views.view.test_group_to_group_relationship_relationship.yml
similarity index 94%
rename from tests/modules/group_test_views/test_views/views.view.test_group_to_group_content_relationship.yml
rename to tests/modules/group_test_views/test_views/views.view.test_group_to_group_relationship_relationship.yml
index 73dc153c..7b174009 100644
--- a/tests/modules/group_test_views/test_views/views.view.test_group_to_group_content_relationship.yml
+++ b/tests/modules/group_test_views/test_views/views.view.test_group_to_group_relationship_relationship.yml
@@ -3,8 +3,8 @@ status: true
 dependencies:
   module:
     - group
-id: test_group_to_group_content_relationship
-label: test_group_to_group_content_relationship
+id: test_group_to_group_relationship_relationship
+label: test_group_to_group_relationship_relationship
 module: views
 description: ''
 tag: ''
@@ -131,7 +131,7 @@ display:
           id: id_1
           table: group_relationship_field_data
           field: id
-          relationship: group_content_id
+          relationship: group_relationship_id
           group_type: group
           admin_label: ''
           label: 'Group relationship ID'
@@ -199,18 +199,18 @@ display:
       footer: {  }
       empty: {  }
       relationships:
-        group_content_id:
-          id: group_content_id
+        group_relationship_id:
+          id: group_relationship_id
           table: groups_field_data
-          field: group_content_id
+          field: group_relationship_id
           relationship: none
           group_type: group
           admin_label: 'Group relationship'
           required: true
-          group_content_plugins:
+          group_relation_plugins:
             group_membership: group_membership
           entity_type: group
-          plugin_id: group_to_group_content
+          plugin_id: group_to_group_relationship
       arguments: {  }
       display_extenders: {  }
     cache_metadata:
diff --git a/tests/src/Kernel/Views/GroupRelationshipToEntityRelationshipTest.php b/tests/src/Kernel/Views/GroupRelationshipToEntityRelationshipTest.php
index 91e32e3b..d25de27f 100644
--- a/tests/src/Kernel/Views/GroupRelationshipToEntityRelationshipTest.php
+++ b/tests/src/Kernel/Views/GroupRelationshipToEntityRelationshipTest.php
@@ -5,7 +5,7 @@ namespace Drupal\Tests\group\Kernel\Views;
 use Drupal\group\Entity\Storage\GroupRelationshipTypeStorageInterface;
 
 /**
- * Tests the group_content_to_entity relationship handler.
+ * Tests the group_relationship_to_entity relationship handler.
  *
  * @see \Drupal\group\Plugin\views\relationship\GroupRelationshipToEntity
  *
@@ -23,7 +23,7 @@ class GroupRelationshipToEntityRelationshipTest extends GroupViewsKernelTestBase
    *
    * @var array
    */
-  public static $testViews = ['test_group_content_to_entity_relationship'];
+  public static $testViews = ['test_group_relationship_to_entity_relationship'];
 
   /**
    * {@inheritdoc}
diff --git a/tests/src/Kernel/Views/GroupRelationshipToEntityReverseRelationshipTest.php b/tests/src/Kernel/Views/GroupRelationshipToEntityReverseRelationshipTest.php
index 877a4e8d..8bf88cfb 100644
--- a/tests/src/Kernel/Views/GroupRelationshipToEntityReverseRelationshipTest.php
+++ b/tests/src/Kernel/Views/GroupRelationshipToEntityReverseRelationshipTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\group\Kernel\Views;
 
 /**
- * Tests the group_content_to_entity_reverse relationship handler.
+ * Tests the group_relationship_to_entity_reverse relationship handler.
  *
  * @see \Drupal\group\Plugin\views\relationship\GroupRelationshipToEntityReverse
  *
@@ -16,6 +16,6 @@ class GroupRelationshipToEntityReverseRelationshipTest extends GroupRelationship
    *
    * @var array
    */
-  public static $testViews = ['test_group_content_to_entity_reverse_relationship'];
+  public static $testViews = ['test_group_relationship_to_entity_reverse_relationship'];
 
 }
diff --git a/tests/src/Kernel/Views/GroupToGroupRelationshipRelationshipTest.php b/tests/src/Kernel/Views/GroupToGroupRelationshipRelationshipTest.php
index 35b686e2..fb6fbc99 100644
--- a/tests/src/Kernel/Views/GroupToGroupRelationshipRelationshipTest.php
+++ b/tests/src/Kernel/Views/GroupToGroupRelationshipRelationshipTest.php
@@ -5,7 +5,7 @@ namespace Drupal\Tests\group\Kernel\Views;
 use Drupal\group\Entity\Storage\GroupRelationshipTypeStorageInterface;
 
 /**
- * Tests the group_to_group_content relationship handler.
+ * Tests the group_to_group_relationship relationship handler.
  *
  * @see \Drupal\group\Plugin\views\relationship\GroupToGroupRelationship
  *
@@ -23,7 +23,7 @@ class GroupToGroupRelationshipRelationshipTest extends GroupViewsKernelTestBase
    *
    * @var array
    */
-  public static $testViews = ['test_group_to_group_content_relationship'];
+  public static $testViews = ['test_group_to_group_relationship_relationship'];
 
   /**
    * {@inheritdoc}
-- 
GitLab