- π¬π§United Kingdom entropea
So I did a didn't get any warning when uninstalling the BEF module (Gr8 module, btw! :)
drush pmu better_exposed_filters [error] A non-existent config entity name returned by FieldStorageConfigInterface::getBundles(): entity type: taxonomy_term, bundle: offences_relating_to_directive_2008_99, field name: field_offences_relating_to_direc [success] Successfully uninstalled: better_exposed_filters
The View in question is now gone without warning.
Sadly it was two days of work without doing a cex, ah well. Just hoping this behaviour can be changed to save any future heartache.
I think the first thing to try is to have all the plugins provided by this module implement
Drupal\views\Plugin\DependentWithRemovalPluginInterface
and itsonDependencyRemoval()
method. It might be convenient to use theDrupal\Core\Plugin\PluginDependencyTrait
as well. One example to look at is theDrupal\views\Plugin\views\field\EntityField
plugin.Basically you want
onDependencyRemoval()
to return TRUE when the BEF module is uninstalled, so that the plugin is removed and hopefully prevents the whole config entity from being deleted.Not sure whether this by itself is sufficient, since the views handlers/plugins ecosystem is complex, but it's probably a good place to start.
- π¬π§United Kingdom joachim
There are at least 2 separate issues here:
> The problem is that there needs to be logic to remove BEF from the view's configuration when BEF is no longer used on the view
> have all the plugins provided by this module implement Drupal\views\Plugin\DependentWithRemovalPluginInterface and its onDependencyRemoval() method
- First commit to issue fork.
- πΊπΈUnited States smustgrave
Would like to hopefully get this in but will admit not sure where to begin.
Took a quick look at this, only really looking at the
ViewsExposedForm
pluginbef
(Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters). Handling the plugin types that BEF provides itself will have to be looked at separately.So, unfortunately, "exposed_form" is not considered a handler type by core views, so when it loops through looking for handler plugins implementing
DependentWithRemovalPluginInterface
, the exposed form plugins are ignored.What needs to be done looks like:
- Implement hook_uninstall()
- In the uinstall hook, load all
view
config entities and filter for those with a dependency onbetter_exposed_filters
- Loop through all the relevant views and all the displays for each view
- In the display options for the display, if the exposed_form type is "bef", set it to "basic" and reset the exposed_form options to the default for basic
- Save the view
- πΊπΈUnited States smustgrave
Dumb question, when you're on the uninstall confirmation screen won't it show that views are still going to be deleted?
Dumb question, when you're on the uninstall confirmation screen won't it show that views are still going to be deleted?
Maybe, I never do things from the UI. But if so, what might be needed a core issue to allow exposed_form plugins on a View to react to a module being uninstalled.