- 🇳🇿New Zealand quietone
I tested this on Drupal 10.1.x, standard install, and confirmed the problem still exists. I have updated the patch a bit. No fix though.
- Status changed to Postponed: needs info
over 1 year ago 3:30pm 7 September 2023 - 🇷🇴Romania vasike Ramnicu Valcea
hmm. tricky thing, imho
If i delete the field, i got the View listed in the confirmation form, But to be updated, which makes sense.
If i delete the content type with the field, we do not have those dependencies "recursively", so we can get also the fields dependencies.
And the results, as issue says, it deletes the View - which i don't think it should happen, if we have another content types.imho, It should the same as for field, the Dependent Views should be updated only.
Imagine there could be plenty of Content types and different Views, that actually wants to use this field, if exists.
It will delete all of the Views, it would be "nicer" to update them.So this looks like a complex problem about removing Dependent Configs (or whatever).
Maybe unify the code used in the "background" and the one used for UI.
And i don't know if there is an existing issue, already.Anyway, i think, this requires some discussions ... at least
So, i changed the status, maybe we'll have more questions to lead us to a plan, for start.
- 🇺🇸United States birchy82
I can confirm this issue happens on Drupal 9.5.10. I recently deleted unused Vocabularys and suddenly the Admin Content view was deleted. I thought I was crazy because right before that I was deleting some unused content types and another set of views were deleted as well.
- 🇺🇸United States joshua.boltz
It seems that this issue is still happening in Drupal 10.1, as I've removed a content type and on drush cex I notice the entire view is deleted, which is not ideal because that view is still used in conjunction with other remaining content types.
- Status changed to Active
11 months ago 8:08am 25 May 2024 - 🇳🇿New Zealand quietone
I think the status here should be active to allow discussion of a solution.
- 🇮🇳India shani maurya Mumbai
I tested this on Drupal 10.1.6, standard install, and confirmed the problem still exists.
- 🇺🇸United States jennypanighetti
I'm still having this as well. Other config files successfully just remove the portion of the config that was mentioned, but specifically in Views, the entire view config file is deleted. This is a big bug.
- 🇮🇳India chandraveer singh
I followed the steps to reproduce the issue but couldn't replicate it. The view appears in the list of all entities scheduled for deletion, which is the expected behavior.
- 🇺🇸United States jennypanighetti
If you have a view where the "Jobs" type is only one of several content types in a given view, the entire view is still deleted. Is that the expected behavior?
- 🇸🇪Sweden arne_hortell
This is a major problem in D11.
If i develop a view in gui and then operate on content types and delete a content type used by the view, the view should NOT be deleted but maybe disabled. As features doesnt really work with D11 yet, it creates a disaster if many views uses the same content type and all of them must be recreated, manually.Thats why its a major issue in D11
- 🇸🇪Sweden arne_hortell
I dont know if this is a solution
use Drupal\views\Entity\View; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageException; function mymodule_entity_predelete(EntityInterface $entity) { if ($entity->getEntityTypeId() === 'node_type') { $content_type_machine_name = $entity->id(); // Load all views. $views = View::loadMultiple(); foreach ($views as $view) { $changed = FALSE; // Loop through all displays in the view. foreach ($view->get('display') as $display_id => $display) { if (!isset($display['display_options']['filters'])) { continue; } // Check if there is a filter for the content type. if (isset($display['display_options']['filters']['type']) && in_array($content_type_machine_name, $display['display_options']['filters']['type']['value'])) { // Remove the specific content type filter (set to all content types). $display['display_options']['filters']['type']['value'] = []; $view->set('display', $display); $changed = TRUE; } } // If changes were made, save the view. if ($changed) { $view->save(); \Drupal::messenger()->addStatus(t('Updated view "@view" to remove dependency on content type "@type".', [ '@view' => $view->label(), '@type' => $content_type_machine_name, ])); } } } }
- 🇦🇹Austria maxilein
How about some log messages?
"view xy about to be deleted by module xy uninstall."
"view xy's configuration export BEFORE changes: "
"view xy's configuration export BEFORE changes: "
"view xy deleted by module xy uninstall. see previous log messages for configuration changes made."