Problem/Motivation
The following message appears on the module uninstallation screen
Create paragraph view mode field on given paragraph type
The following reason prevents Paragraph View Mode from being uninstalled:
The Paragraph view mode field type is used in the following field: paragraph.paragraph_view_mode
However, the paragraph.paragraph_view_mode field is not set for all paragraph types.
It is not present in the field list, nor is it present in the form display.
This is because I have just installed and have not tried the module yet.
environment:
Drupal core 10.2.5
Paragraphs 8.x-1.17
Paragraphs Features 2.0.0-beta4
Paragraphs Editor Enhancements 10.0.3
Paragraph View Mode 3.1.3
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | paragrpah-view-mode-uninstall-2024-05-13 22-36.mp4 | 6.94 MB | sayco |
| #9 | 3441626-cannot-uninstall-module.patch | 5.74 KB | sathishdevan |
Issue fork paragraph_view_mode-3441626
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
Comment #2
s-jack commentedJust to be sure, the following tasks were verified.
It is odd that the module cannot be uninstalled because the field is assumed to be in use, even though everything using the paragraph has been removed.
Is the only possibility left to remove the other paragraph-related modules themselves?
Comment #3
s-jack commentedUninstalled and verified the modules related to paragraphs.
To my surprise, the remaining two Paragraphs and Paragraph View Mode modules are interdependent and neither can be removed.
This seems to be a bug.
Comment #4
s-jack commentedCreated a new clean site test environment.
Installed only Paragraphs 8.x-1.17 and Paragraph View Mode 3.1.3 modules.
I did not create any content using paragraphs or paragraph types, only modules were installed.
The Paragraph View Mode module cannot be uninstalled.
Therefore, the module also cannot be uninstalled due to dependencies.
Comment #7
sathishdevan commentedHi Jack,
The paragraph_view_mode field is created on the installation process and that blocks the uninstallation of the module. I have a create a path from where you can delete the field and then you should be able to uninstall the module.
Comment #8
s-jack commentedHi sathishdevan.
I am a user with a level of interest in basic programming, so I do not understand the detailed specifications.
I assume that fields are reusable when they are placed in concrete bundles. But are you saying that the fields in this module are created internally without placing them in a bundle?
If so, then the fact that fields cannot be deleted is a specification and not a bug.
However, from the user's perspective, it is very inconvenient to not be able to uninstall without special work.
What exactly do you mean by "if you create a path to delete a field?"
Comment #9
sathishdevan commentedHi Jack,
I have created patch for this uninstall issue.
This patch will create a new route. If you navigate to this route /admin/config/content/paragraph-view-mode-delete, you will have provision to delete the field which is created by the module and then you can uninstall the module.
Comment #10
sathishdevan commentedComment #11
sayco commentedHi, thanks for reporting.
It seems to be indeed the issue.
One very simple workaround for this is to add a paragraph field to any paragraph type and then remove it.
It will trigger the internal Drupal logic to remove the field storage if the field is no longer used in any entity (see video attached).
I don't think that what was proposed in a patch makes sense, to be honest.
The code is correct, but I don't think we need this complex solution for a simple issue.
The original issue is that on hook_install the field storage is created, but it should be created "on the fly" when creating the field.
So to fix the issue permanently, the hook_install has just to be removed.
Comment #13
sayco commentedI just pushed the change by removing the hook install to a dev branch.
This will, of course, won't help your issue (only the workaround I mentioned will help you),
but this will prevent future installations from falling into the same issue.
I consider the issue fixed, and for future reference I'll paste again the workaround:
One very simple workaround for this is to add a paragraph field to any paragraph type and then remove it.
Comment #14
s-jack commentedHi sathishdevan and sayco.
I had not yet applied the patch to check it, but once I placed the field in the paragraph type and immediately removed it, I confirmed that the module can be uninstalled.
Thank you for pushing the patch.