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.
Comments
Comment #2
gombi commentedI've implemented an uninstall hook that resolves the issue.
Comment #4
gombi commentedI'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).
Comment #5
nkoporec