I'm getting a hard error if I edit content with the group selector widget enabled, or if I view content with the groups formatter enabled.

The setup is very default, a single test group type, a single test group of that type, and a single content plugin enabled. Editing/viewing any node of that content type produces an error, whether the node is already a member of a group or not.

CommentFileSizeAuthor
#6 3154400-6.patch2.65 KBdww

Comments

John Pitcairn created an issue. See original summary.

johnpitcairn’s picture

To avoid polluting the issue summary, here's the trace:

The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\group\Plugin\GroupContentEnablerManager::getPluginIdsByEntityType() in Drupal\entitygroupfield\Field\EntityGroupFieldItemList->computeValue() (line 27 of modules/contrib/entitygroupfield/src/Field/EntityGroupFieldItemList.php).

Drupal\entitygroupfield\Field\EntityGroupFieldItemList->computeValue() (Line: 34)
Drupal\entitygroupfield\Field\EntityGroupFieldItemList->ensureComputedValue() (Line: 138)
Drupal\entitygroupfield\Field\EntityGroupFieldItemList->count()
count(Object) (Line: 76)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 178)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 125)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 127)
Drupal\node\NodeForm->form(Array, Object) (Line: 149)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 532)
Drupal\Core\Form\FormBuilder->retrieveForm('node_person_edit_form', Object) (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
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: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
johnpitcairn’s picture

Yup, there is no such method in group 8.x-1.0-rc5 or current 8.x-1.x-dev. How on earth is this expected to work?

johnpitcairn’s picture

I needed Group dev and the patch at #3152324: Add a getPluginIdsByEntityType() method to src/Plugin/GroupContentEnablerManager to make this module usable.

dww’s picture

Sorry you spent time on this. I probably should have mentioned that issue/patch on the project node. This is all exactly expected (for now).

But that issue is taking a while, so I'm thinking of doing our own thing until that solution lands in Group core.

dww’s picture

Priority: Normal » Major
Status: Active » Needs review
Related issues: +#3152324: Add a getPluginIdsByEntityType() method to src/Plugin/GroupContentEnablerManager
StatusFileSize
new2.65 KB

I looked into service decoration and that whole fancy mess, but it seems to be a huge PITA and a ton of bloat for such a trivial thing. I'll probably be struck down by lightning for such blasphemy, but this simple procedural solution seems way easier, especially since this is just stop-gap code until this method is provided by Group core.

Thoughts?
-Derek

johnpitcairn’s picture

Status: Needs review » Reviewed & tested by the community

I share your skepticism about some of the sillier OO complexity that gets produced ;-)

This at least allows me to not chase group dev, a practice that I really try to avoid, and at least I'm patching the module that has the issue. I'm prototyping to determine whether group can reasonably support the slightly offbeat access model I need. I suspect it will be more work and custom code to bend group to do what I want than to just write the node access grant code myself, and group UI is pretty awful for my use-case (which is why this module seems promising), so I suspect I won't be around for long.

Anyway, I'm happy to call this RTBC. It doesn't explode when I touch it any more.

dww’s picture

Title: Error when editing with widget enabled or viewing with formatter enabled » GroupContentEnablerManager::getPluginIdsByEntityType() undefined (see #3152324), roll our own

More specific title and saving credits. Thanks!

  • dww committed 143c8a3 on 1.0.x
    Issue #3154400 by dww, John Pitcairn: GroupContentEnablerManager::...
dww’s picture

Status: Reviewed & tested by the community » Fixed
johnpitcairn’s picture

Thanks for the fast alpha update!

Status: Fixed » Closed (fixed)

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