Problem/Motivation

The regular Group module has support for Drupal 10, but the Subgroup module does not.

Here it would be good if we could enable support for Drupal 10 as well.

Most installations still run with version 1, an update to 2.x is often not possible, because in other group projects no update is available yet. So we will probably stay with Subgroup 1.x for a while, but at the moment it is not possible to update to Drupal 10.

The restriction in composer.json is actually done quickly and without problems, but update status still gives out the following things that should be fixed.

modules/contrib/subgroup/src/Event/GroupLeafEvent.php 13
Class Drupal\subgroup\Event\GroupLeafEvent extends deprecated class Symfony\Component\EventDispatcher\Event: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead

modules/contrib/subgroup/src/Event/GroupTypeLeafEvent.php 13
Class Drupal\subgroup\Event\GroupTypeLeafEvent extends deprecated class Symfony\Component\EventDispatcher\Event: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead

modules/contrib/subgroup/src/Form/SubgroupSettingsForm.php 262
Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

modules/contrib/subgroup/src/Form/SubgroupSettingsForm.php 569
Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

modules/contrib/subgroup/tests/src/Kernel/GroupViewTest.php 112
Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

modules/contrib/subgroup/subgroup.info.yml 0
Value of core_version_requirement: ^8.8 || ^9 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687..

Steps to reproduce

Proposed resolution

* Provide patch or new release

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork subgroup-3347570

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

zcht created an issue. See original summary.

Ranjit1032002 made their first commit to this issue’s fork.

ranjit1032002’s picture

Status: Active » Needs review
StatusFileSize
new456 bytes

Created a Patch for the issue mentioned, please review.
Thank you

zcht’s picture

Status: Needs review » Needs work

the patch is not complete, see my description holistic.

jan-e’s picture

I totally agree with you that we should fix the D10 compatibility for Subgroup 1.x. Are you working on a patch?

zcht’s picture

My dev skills are not that strong, I could try it. I'm just not sure with the stuff about entity queries if I would get it changed properly.

shivam_tiwari made their first commit to this issue’s fork.

shivam_tiwari’s picture

Status: Needs work » Needs review
kristiaanvandeneynde’s picture

Subgroup 1 targets Group 1, which is not getting any more D10 love from my end, see #3278740-25: D10 compatibility. I would imagine treating Subgroup 1 the same way: If anyone provides patches that work well, I might commit them, but I'd need some +1s from people who can truly vouch the code looks good. #6 does not give me a lot of confidence in that regard :)

zcht’s picture

Status: Needs review » Needs work

The MR for compatibility already goes in the right direction, however, this is buggy, at the moment in no case use in productive environment. The patch itself applied clean and everything works as it should, existing subgroups can be edited/updated/displayed. BUT: as soon as a new subgroup is created an extremely ugly error occurs. Subgroups are created, but not linked to the group, here the logic is completely broken. Thus linked node types cannot be inserted into the subgroup or other entities.

On closer analysis I found that after the patch no relationships are created for subgroup_depth, subgroup_left, subgroup_right, subgroup_tree. The logic for this seems to be completely missing. On further analysis and testing, I also get error messages when new entities are added to the subgroup.

My setup consists of Drupal 9.5.9, PHP 8.1, Group 1.5 and Subgroup 1.0.2

The website encountered an unexpected error. Please try again later.
Error: Undefined constant "Drupal\subgroup\Event\Symfony\Contracts\EventDispatcher\Event" in include() (line 6 of modules/contrib/subgroup/src/Event/GroupLeafEvent.php).
include() (Line: 582)
Composer\Autoload\{closure}('/var/www/html/docroot/modules/contrib/subgroup/src/Event/GroupLeafEvent.php') (Line: 433)
Composer\Autoload\ClassLoader->loadClass('Drupal\subgroup\Event\GroupLeafEvent') (Line: 91)
subgroup_group_update(Object)
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'subgroup') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('group_update', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('group_update', Array) (Line: 249)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 51)
Drupal\subgroup\Entity\GroupSubgroupHandler->writeLeafData(Object, 1, 2, 3, 8610) (Line: 278)
Drupal\subgroup\Entity\SubgroupHandlerBase->doAddLeaf(Object, Object) (Line: 103)
Drupal\subgroup\Entity\GroupSubgroupHandler->doAddLeaf(Object, Object) (Line: 213)
Drupal\subgroup\Entity\SubgroupHandlerBase->addLeaf(Object, Object) (Line: 240)
subgroup_group_content_insert(Object)
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'subgroup') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('group_content_insert', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('group_content_insert', Array) (Line: 249)
Drupal\Core\Entity\EntityStorageBase->invokeHook('insert', Object) (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object) (Line: 598)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 523)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 157)
Drupal\group\Entity\Group->addContent(Object, 'subgroup:MYSUBGROUPNAME', Array) (Line: 656)
group_content_entity_submit(Array, Object)
call_user_func_array('group_content_entity_submit', Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('group_MYSUBGROUPNAME_add_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'add', Array) (Line: 368)
Drupal\group\Entity\Controller\GroupContentController->createForm(Object, 'subgroup:MYSUBGROUPNAME')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
zcht’s picture

Status: Needs work » Needs review
StatusFileSize
new56.66 KB

Have now created the first patch that works for me. No errors are thrown, subgroups can be edited and created. Fixed minor coding standards, set minimum group version to 1.5, declared Drupal 9.5 as minimum version. Tested under PHP 8.1, Drupal 9.5.9 & Drupal 10.x

Feedback and testing would be appreciated.

zcht’s picture

Unfortunately, the patch with the adjustments for coding standards collides with the important patch #3281672

The patch of @Jan-E I see as mandatory for the next release of Subgroup. So here is the minimum version for compatibility for Drupal 10.

zcht’s picture

jan-e’s picture

I will take a look at it next week.

jan-e’s picture

Added related issue for the Group 8.x-1.x branch.

zcht’s picture

StatusFileSize
new6.8 KB

Patch rerolled, on closer testing it was noticed that in the subgroup.module the statement for $event_dispatcher was in the wrong order and led to a fatal error under Drupal 10 when creating or updating a subgroup.

zcht’s picture

StatusFileSize
new6.79 KB

Also here, found some more. Existing accessCheck should NOT be changed, patch reroled.

jan-e’s picture

Group 8.x-1.6 added support for D10 now. How about Subgroup?

kristiaanvandeneynde’s picture

I can see how much of the budget for the new Group release is left and perhaps use that here. Would need to find some time to figure that out.

kristiaanvandeneynde’s picture

StatusFileSize
new20.08 KB

Removing credit from low-effort merge requests, adding updated tests and accessCheck(FALSE) on config entity queries.

jan-e’s picture

Thanks a lot! For a final Subgroup 1.x release the fix for doAddLeaf & doRemoveLeaf: timestamp bug and scalability should be merged in the 1.0.x branch as well. You only merged that fix into the 2.0.x and 3.0.x branches as far as I know.

kristiaanvandeneynde’s picture

Status: Needs review » Fixed

I'm not too fond of being told what I should do as a maintainer. I've got some budget left so I'll see what I can do.

jan-e’s picture

Sorry. I should have asked you if that could be done as well. And it was a reminder to my self that that fix was not in the 1.0.x branch yet.

kristiaanvandeneynde’s picture

Title: Compatibility for Drupal 10 at Subgroup 1.x » Compatibility for Drupal 10

Turns out this was also needed for v2 and v3, but because we didn't have D10 tests it never showed up.

kristiaanvandeneynde’s picture

Re #26 no worries and thanks for working on the other issue. It's just that as a maintainer you get a lot of people telling you what to do without helping out at all. You clearly do help out, so I appreciate the help and apologize if I came across a bit blunt.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.