Problem/Motivation

After enabling the module, PHP error shows up.

Steps to reproduce

Get module using composer:

> composer require drupal/tb_megamenu
Using version ^1.0 for drupal/tb_megamenu
./composer.json has been updated
Running composer update drupal/tb_megamenu
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking drupal/tb_megamenu (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading drupal/tb_megamenu (1.0.0)
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/tb_megamenu (1.0.0): Extracting archive

Then enable the module on Drupal's 'Extend' page.
After that this error appears:
The website encountered an unexpected error. Please try again later.
ParseError: syntax error, unexpected ')' in Composer\Autoload\includeFile() (line 49 of modules/contrib/tb_megamenu/src/Plugin/Derivative/TBMegaMenuBlock.php).

Composer\Autoload\includeFile('/app/web/modules/contrib/tb_megamenu/src/Plugin/Derivative/TBMegaMenuBlock.php') (Line: 322)
Composer\Autoload\ClassLoader->loadClass('Drupal\tb_megamenu\Plugin\Derivative\TBMegaMenuBlock')
spl_autoload_call('Drupal\tb_megamenu\Plugin\Derivative\TBMegaMenuBlock')
class_exists('Drupal\tb_megamenu\Plugin\Derivative\TBMegaMenuBlock') (Line: 217)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDeriverClass(Array) (Line: 20)
Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator->getDeriver('tb_megamenu_menu_block', Array) (Line: 99)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 284)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 175)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 22)
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('system_breadcrumb_block') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('system_breadcrumb_block', Array) (Line: 76)
Drupal\Component\Plugin\PluginManagerBase->createInstance('system_breadcrumb_block', Array) (Line: 62)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('system_breadcrumb_block') (Line: 57)
Drupal\block\BlockPluginCollection->initializePlugin('system_breadcrumb_block') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('system_breadcrumb_block') (Line: 45)
Drupal\block\BlockPluginCollection->get('system_breadcrumb_block') (Line: 83)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->setConfiguration(Array) (Line: 99)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->addInstanceId('system_breadcrumb_block', Array) (Line: 55)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->__construct(Object, 'system_breadcrumb_block', Array) (Line: 34)
Drupal\block\BlockPluginCollection->__construct(Object, 'system_breadcrumb_block', Array, 'seven_breadcrumbs') (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: 370)
Drupal\Core\Entity\EntityBase->access('view', NULL, 1) (Line: 56)
Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array) (Line: 137)
Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() (Line: 259)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
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('kernel.view', Object) (Line: 156)
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)

Proposed resolution

Fix the code?

Comments

firfin created an issue. See original summary.

firfin’s picture

I get a working site again after changing line 48 in TBMEgaMenuBlock.php from
$container->get('entity_type.manager'),
to
$container->get('entity_type.manager')

Can make a patch tomorrow.

themodularlab’s picture

Thanks @firfin for flagging this issue and providing a fix! I can go ahead and make the adjustment so you don't have to worry about a patch but I'll make sure to provide credit once the issue is closed. Thanks so much for helping us out with this module. Your contributions are greatly appreciated.

themodularlab’s picture

Status: Active » Reviewed & tested by the community

This is now on the dev branch. I'll have a minor release up shortly.

themodularlab’s picture

Status: Reviewed & tested by the community » Fixed

Changes fixed in 8.x-1.1 release. Thanks again!

Status: Fixed » Closed (fixed)

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