Class "Drupal\group\Entity\GroupContentType" not found

Created on 8 February 2024, 5 months ago
Updated 13 February 2024, 5 months ago

Problem/Motivation

When trying to edit a field in a given Content Type the following error occurs:

Error: Class "Drupal\group\Entity\GroupContentType" not found in Drupal\field_permissions_group\CurrentGroupType->getGroupTypeFromRoute() (line 87 of /modules/contrib/field_permissions_group/src/CurrentGroupType.php).

This is happening on every field when clicking edit.

Steps to reproduce

The module was installed and then attempted to edit a field in a given content type (article). The edit form doesn't load and the site crashes.

Proposed resolution

Looking into the groups module they changed the class from GroupContentType to GroupRelationship when switching from version 8 to version 2.x and 3.x. They also changed the method to be LoadByPluginId. This method accepts the id instead of the entity and so I suggest this method be used instead of LoadByEntity. The CurrentGroupType.php file needs to be updated to reflect these changes.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States gregrusson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @gregrusson
  • πŸ‡ΊπŸ‡ΈUnited States gregrusson

    Created a patch to resolve the issue. The patch updates references to the GroupContentType class and replaces them with GroupRelationship class.

  • Status changed to Needs review 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States gregrusson
  • πŸ‡ΊπŸ‡ΈUnited States gregrusson

    gregrusson β†’ changed the visibility of the branch 3420219-class-drupalgroupentitygroupcontenttype-not to hidden.

  • πŸ‡©πŸ‡ͺGermany Istari

    The patch doesn"t work for me.
    This is the error output:

    Fatal error: Declaration of Drupal\field_permissions_group\Plugin\FieldPermissionType\CustomGroupAccess::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?Drupal\field\FieldConfigInterface $field_config = null) must be compatible with Drupal\field_permissions\Plugin\FieldPermissionType\Base::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?Drupal\field\FieldStorageConfigInterface $field_storage = null) in /var/www/html/web/modules/contrib/field_permissions_group/src/Plugin/FieldPermissionType/CustomGroupAccess.php on line 70

    Tested with Drupal 10.1.8
    Group 3.2.2
    Field Permissions 1.3

Production build 0.69.0 2024