Error: Call to undefined method Drupal\group\Entity\GroupType::getContentPlugin

Created on 20 May 2023, over 1 year ago
Updated 10 January 2024, 11 months ago

Hi, I appreciated this method to let users contact each other without having to give access to a role access to user personal contact forms. I don't think there's another way to do this in D10. However, this error prevents me from moving forward. It is resolved by uninstalling. I don't see another dev version I can try.

"drupal/gcontact": "^1.1"

"drupal/gcontact": {
        "d10": "https://www.drupal.org/files/issues/2022-06-15/gcontact.1.1.rector.patch",
         "Minor coding standard fix": "https://www.drupal.org/files/issues/2877194-2.patch"
}

To replicate on a fresh d10 install - install group, contact, and gcontact, the following error message results.

Please help me get this working.

Error message:
The website encountered an unexpected error. Please try again later.

Error: Call to undefined method Drupal\group\Entity\GroupType::getContentPlugin() in gcontact_entity_extra_field_info() (line 37 of modules/contrib/gcontact/gcontact.module).
call_user_func_array(Object, Array) (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'gcontact') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_extra_field_info', Object) (Line: 416)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_extra_field_info') (Line: 661)
Drupal\Core\Entity\EntityFieldManager->getExtraFields('block_content', 'basic') (Line: 99)
Drupal\layout_builder\Plugin\Derivative\ExtraFieldBlockDeriver->getDerivativeDefinitions(Array) (Line: 101)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 291)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 181)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 22)
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('local_actions_block') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('local_actions_block', Array) (Line: 76)
Drupal\Component\Plugin\PluginManagerBase->createInstance('local_actions_block', Array) (Line: 62)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('local_actions_block') (Line: 57)
Drupal\block\BlockPluginCollection->initializePlugin('local_actions_block') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('local_actions_block') (Line: 45)
Drupal\block\BlockPluginCollection->get('local_actions_block') (Line: 83)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->setConfiguration(Array) (Line: 99)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->addInstanceId('local_actions_block', Array) (Line: 55)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->__construct(Object, 'local_actions_block', Array) (Line: 34)
Drupal\block\BlockPluginCollection->__construct(Object, 'local_actions_block', Array, 'claro_local_actions') (Line: 156)
Drupal\block\Entity\Block->getPluginCollection() (Line: 145)
Drupal\block\Entity\Block->getPlugin() (Line: 118)
Drupal\block\BlockAccessControlHandler->checkAccess(Object, 'view', Object) (Line: 105)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', Object, 1) (Line: 314)
Drupal\Core\Entity\EntityBase->access('view', NULL, 1) (Line: 63)
Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array) (Line: 137)
Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() (Line: 270)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 168)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
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: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 686)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

/**
 * Implements hook_entity_extra_field_info().
 */
function gcontact_entity_extra_field_info() {
  $extra = [];

  // Add each profile type as an extra field for display. Enabled by default.
  foreach (GroupType::loadMultiple() as $group_type) {
    $plugin = $group_type->getContentPlugin('group_membership');
    $extra['group_content'][$plugin->getContentTypeConfigId()]['display']['contact'] = [
      'label' => t('Contact link'),
      'description' => t("Display a link to the member's contact form."),
      'weight' => 10,
      'visible' => TRUE,
    ];
  }

  return $extra;
}


🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇺🇸United States drupgirl

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

Comments & Activities

  • Issue created by @drupgirl
  • 🇮🇳India bharath-kondeti Hyderabad

    @drupgirl Is this tested on Drupal 10 ?. There is no official release for this module for d10. I was not able to download this module using composer. Can you please help me reproduction steps.

  • 🇺🇸United States adriancotter

    Some of the API names have changed, as per:
    https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib...

    This is for Group 2.0, I think 3.0 is similar
    In this case from the documentation above:
    getContentPlugin becomes just getPlugin

    There's some other big changes around how the plugin is created, so this change may or may not be sufficient. Otherwise, the other big change is changing class references for GroupContent to GroupRelationship.

    Plugin names stay the same between 1.0 and 2.0, but 3.0's are different.

    Adrian

Production build 0.71.5 2024