Problem/Motivation

The module currently doesn't implement an uninstall hook. Uninstalling and then installing the module again will produce errors.

In PreExistingConfigException.php line 65:                                                                                          
  Configuration objects (views.view.content_recycle_bin) provided by entity_recycle already exist in active configuration  
In EntityStorageBase.php line 485:
                                                                         
  'field_config' entity with ID 'node.page.recycle_bin' already exists. 
Warning: array_keys() expects parameter 1 to be array, null given in Drupal\entity_recycle\EntityRecycleViewManager->entityAccess() (line 70 of modules/contrib/entity_recycle/src/EntityRecycleViewManager.php).

Drupal\entity_recycle\EntityRecycleViewManager->entityAccess(Object, Object) (Line: 68)
entity_recycle_entity_access(Object, 'view', Object)
call_user_func_array('entity_recycle_entity_access', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_access', Array) (Line: 96)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', Object, 1) (Line: 314)
Drupal\Core\Entity\EntityBase->access('view', NULL, 1) (Line: 56)
Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array) (Line: 137)
Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() (Line: 274)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
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: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The recycle_bin field also doesn't get removed upon uninstalling the module.

Steps to reproduce

1. Enable Entity Recycle
2. Disable Entity Recycle
3. Enable Entity Recycle

Proposed resolution

Implement uninstall hook to clear the configuration set during install.

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

gombi created an issue. See original summary.

gombi’s picture

Assigned: gombi » Unassigned
Status: Active » Needs review

I've implemented an uninstall hook that resolves the issue.

gombi’s picture

I've fixed an oversight in my previous commit where the uninstall hook was only deleting the recycle_bin field on the node entity type. It should now delete the recycle_bin fields from all enabled entity types (and their bundles).

nkoporec’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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