Loading config/optional/views.view.group_members.yml +8 −8 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ label: 'Group members' module: group description: '' tag: '' base_table: group_content_field_data base_table: group_relationship_field_data base_field: id core: 8.x display: Loading Loading @@ -282,7 +282,7 @@ display: plugin_id: field changed: id: changed table: group_content_field_data table: group_relationship_field_data field: changed relationship: none group_type: group Loading Loading @@ -349,7 +349,7 @@ display: plugin_id: field created: id: created table: group_content_field_data table: group_relationship_field_data field: created relationship: none group_type: group Loading Loading @@ -416,7 +416,7 @@ display: plugin_id: field view_group_content: id: view_group_content table: group_content table: group_relationship field: view_group_content relationship: none group_type: group Loading Loading @@ -469,7 +469,7 @@ display: absolute: false edit_group_content: id: edit_group_content table: group_content table: group_relationship field: edit_group_content relationship: none group_type: group Loading Loading @@ -520,7 +520,7 @@ display: plugin_id: entity_link_edit delete_group_content: id: delete_group_content table: group_content table: group_relationship field: delete_group_content relationship: none group_type: group Loading Loading @@ -646,7 +646,7 @@ display: relationships: gc__user: id: gc__user table: group_content_field_data table: group_relationship_field_data field: gc__user relationship: none group_type: group Loading @@ -659,7 +659,7 @@ display: arguments: gid: id: gid table: group_content_field_data table: group_relationship_field_data field: gid relationship: none group_type: group Loading group.install +28 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\group\Entity\GroupRelationship; use Drupal\group\Entity\GroupTypeInterface; use Drupal\group\PermissionScopeInterface; use Drupal\user\RoleInterface; Loading Loading @@ -260,3 +261,30 @@ function group_update_9208() { $definition_update_manager->installEntityType($entity_type); } } /** * Update the group_content handlers. */ function group_update_9209() { $new_handlers = \Drupal::entityTypeManager()->getDefinition('group_content')->getHandlerClasses(); $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $entity_type = $definition_update_manager->getEntityType('group_content'); $entity_type->set('handlers', $new_handlers); $definition_update_manager->updateEntityType($entity_type); } /** * Update the group_content database tables. */ function group_update_9210(&$sandbox) { $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository'); assert($last_installed_schema_repository instanceof EntityLastInstalledSchemaRepositoryInterface); $field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions('group_content'); $entity_type = $definition_update_manager->getEntityType('group_content'); $entity_type->setClass(GroupRelationship::class); $entity_type->set('base_table', 'group_relationship'); $entity_type->set('data_table', 'group_relationship_field_data'); $definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions, $sandbox); } modules/gnode/config/optional/views.view.group_nodes.yml +1 −1 Original line number Diff line number Diff line Loading @@ -872,7 +872,7 @@ display: arguments: gid: id: gid table: group_content_field_data table: group_relationship_field_data field: gid relationship: group_content group_type: group Loading src/Entity/GroupRelationship.php +2 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,8 @@ use Drupal\user\EntityOwnerTrait; * }, * "access" = "Drupal\group\Entity\Access\GroupRelationshipAccessControlHandler", * }, * base_table = "group_content", * data_table = "group_content_field_data", * base_table = "group_relationship", * data_table = "group_relationship_field_data", * translatable = TRUE, * entity_keys = { * "id" = "id", Loading src/Entity/Views/GroupRelationshipViewsData.php +4 −4 Original line number Diff line number Diff line Loading @@ -34,16 +34,16 @@ class GroupRelationshipViewsData extends EntityViewsData { public function getViewsData() { $data = parent::getViewsData(); // Get the data table for GroupRelationship entities. $data_table = $this->entityType->getDataTable(); // Add a custom numeric argument for the parent group ID that allows us to // use replacement titles with the parent group's label. $data['group_content_field_data']['gid']['argument'] = [ $data[$data_table]['gid']['argument'] = [ 'id' => 'group_id', 'numeric' => TRUE, ]; // Get the data table for GroupRelationship entities. $data_table = $this->entityType->getDataTable(); // Unset the 'entity_id' field relationship as we want a more powerful one. // @todo Eventually, we may want to replace all of 'entity_id'. unset($data[$data_table]['entity_id']['relationship']); Loading Loading
config/optional/views.view.group_members.yml +8 −8 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ label: 'Group members' module: group description: '' tag: '' base_table: group_content_field_data base_table: group_relationship_field_data base_field: id core: 8.x display: Loading Loading @@ -282,7 +282,7 @@ display: plugin_id: field changed: id: changed table: group_content_field_data table: group_relationship_field_data field: changed relationship: none group_type: group Loading Loading @@ -349,7 +349,7 @@ display: plugin_id: field created: id: created table: group_content_field_data table: group_relationship_field_data field: created relationship: none group_type: group Loading Loading @@ -416,7 +416,7 @@ display: plugin_id: field view_group_content: id: view_group_content table: group_content table: group_relationship field: view_group_content relationship: none group_type: group Loading Loading @@ -469,7 +469,7 @@ display: absolute: false edit_group_content: id: edit_group_content table: group_content table: group_relationship field: edit_group_content relationship: none group_type: group Loading Loading @@ -520,7 +520,7 @@ display: plugin_id: entity_link_edit delete_group_content: id: delete_group_content table: group_content table: group_relationship field: delete_group_content relationship: none group_type: group Loading Loading @@ -646,7 +646,7 @@ display: relationships: gc__user: id: gc__user table: group_content_field_data table: group_relationship_field_data field: gc__user relationship: none group_type: group Loading @@ -659,7 +659,7 @@ display: arguments: gid: id: gid table: group_content_field_data table: group_relationship_field_data field: gid relationship: none group_type: group Loading
group.install +28 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\group\Entity\GroupRelationship; use Drupal\group\Entity\GroupTypeInterface; use Drupal\group\PermissionScopeInterface; use Drupal\user\RoleInterface; Loading Loading @@ -260,3 +261,30 @@ function group_update_9208() { $definition_update_manager->installEntityType($entity_type); } } /** * Update the group_content handlers. */ function group_update_9209() { $new_handlers = \Drupal::entityTypeManager()->getDefinition('group_content')->getHandlerClasses(); $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $entity_type = $definition_update_manager->getEntityType('group_content'); $entity_type->set('handlers', $new_handlers); $definition_update_manager->updateEntityType($entity_type); } /** * Update the group_content database tables. */ function group_update_9210(&$sandbox) { $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository'); assert($last_installed_schema_repository instanceof EntityLastInstalledSchemaRepositoryInterface); $field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions('group_content'); $entity_type = $definition_update_manager->getEntityType('group_content'); $entity_type->setClass(GroupRelationship::class); $entity_type->set('base_table', 'group_relationship'); $entity_type->set('data_table', 'group_relationship_field_data'); $definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions, $sandbox); }
modules/gnode/config/optional/views.view.group_nodes.yml +1 −1 Original line number Diff line number Diff line Loading @@ -872,7 +872,7 @@ display: arguments: gid: id: gid table: group_content_field_data table: group_relationship_field_data field: gid relationship: group_content group_type: group Loading
src/Entity/GroupRelationship.php +2 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,8 @@ use Drupal\user\EntityOwnerTrait; * }, * "access" = "Drupal\group\Entity\Access\GroupRelationshipAccessControlHandler", * }, * base_table = "group_content", * data_table = "group_content_field_data", * base_table = "group_relationship", * data_table = "group_relationship_field_data", * translatable = TRUE, * entity_keys = { * "id" = "id", Loading
src/Entity/Views/GroupRelationshipViewsData.php +4 −4 Original line number Diff line number Diff line Loading @@ -34,16 +34,16 @@ class GroupRelationshipViewsData extends EntityViewsData { public function getViewsData() { $data = parent::getViewsData(); // Get the data table for GroupRelationship entities. $data_table = $this->entityType->getDataTable(); // Add a custom numeric argument for the parent group ID that allows us to // use replacement titles with the parent group's label. $data['group_content_field_data']['gid']['argument'] = [ $data[$data_table]['gid']['argument'] = [ 'id' => 'group_id', 'numeric' => TRUE, ]; // Get the data table for GroupRelationship entities. $data_table = $this->entityType->getDataTable(); // Unset the 'entity_id' field relationship as we want a more powerful one. // @todo Eventually, we may want to replace all of 'entity_id'. unset($data[$data_table]['entity_id']['relationship']); Loading