I try to uninstall the module and receive the following error.

[error]  Plugin ID 'condition_group' was not found.

At the moment I am not able to uninstall the module even with drush cim not. I removed all references and removed it also from core.extension without success. Any ideas how to fix this issue?

Comments

Anonymous’s picture

Almare created an issue. See original summary.

arnaud-brugnon’s picture

I have the same issue
I agree that it is really annoying and i will never do it in normal case.

But in this case, like i want to uninstall this module, i have to edit block_visibility_groups_uninstall function.

If you remove those lines, you will be able to uninstall this module.

foreach ($blocks as $block) {
$conditions = $block->getVisibilityConditions();
if ($conditions->get('condition_group')) {
$conditions->removeInstanceId('condition_group');
$block->save();
}
}

vishalkhode’s picture

I added has condition to check if block has an instance condition_group. You can apply this patch, this fixes issue.

vishalkhode’s picture

Status: Active » Needs review
msankhala’s picture

Status: Needs review » Needs work

@visshu007 Thanks for the patch. I am not sure if this is a correct way to fix this uninstallation issue. I followed these steps to test this patch.

  1. I installed version 8.x-1.2 and applied patch #3
  2. Created few block visibility groups and added few conditions and applied those conditions to these created block groups.
  3. Tried to uninstall this module by setting a breakpoint on the line where you made the change. This change from get() to has() simply made this condition false and prevented this if block to execution.

I think we need to understand why this [error] Plugin ID 'condition_group' was not found. error is being thrown at first place.

Moving this to Need work.

dadderley’s picture

This was behaving badly and borked my block settings.
I could not uninstall this module. The patch in #3 allowed a clean uninstall.
Thanks

tedbow’s picture

Component: User interface » Code
Priority: Critical » Major
Issue tags: +Needs tests
Related issues: +#2880373: Delete blocks on uninstall

This uninstall function was added in #2880373: Delete blocks on uninstall

It add test coverage in \Drupal\block_visibility_groups\Tests\VisibilityTest::testSingleConditions

To do a basic test on uninstall. The first step for this issue would be updating test coverage to demonstrate this problem.

A few questions:

  1. Has this problem been tested with just Drupal core and this module enabled?
  2. Which versions of core?
  3. With only core does this happen when uninstall the module through the UI? Drush? Drupal console? All 3?

bumping down to "Major" since the answers to these 3 questions would determine how it is critical.

jonathanshaw’s picture

I'm getting this while:
- starting with a a D8.3 or D8.4 prod database
- composer update for both core (to 8.5) and maybe this module
- drush updb
- drush cim (module is disabled in core.extension.yml therefore uninstalled on cim; config comes from D8.5 dev environment)

jonathanshaw’s picture

The patch from #4 didn't suffice for me, as I still hit issues during the uninstall of this module when the route could not be detected by the redirect module's entity delete hook. The fix was to uninstall the module in the db prior to config import.

robshambaugh’s picture

The uninstall patch in #3 worked for me for Drupal 8.5.5. Thanks!

robshambaugh’s picture

mherchel’s picture

The patch in #3 worked for me, also running 8.5.5.

  • mlncn committed f854e98 on 8.x-1.x authored by visshu007
    Issue #2952819 by visshu007: Can't uninstall module
    
mlncn’s picture

Committed #3 as reported working harm reduction. Leaving issue open for now as it's not clear it's the correct/sufficient fix.

mlncn’s picture

Status: Needs work » Fixed

No problems reported since the patch here and #2880373: Delete blocks on uninstall were released.

Status: Fixed » Closed (fixed)

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