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

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

s-jack created an issue. See original summary.

s-jack’s picture

Just to be sure, the following tasks were verified.

  1. Tried to delete all content that uses paragraphs, but the fields cannot be deleted and the module cannot be uninstalled.
  2. Tried to delete all content types that use paragraph types, but the fields cannot be deleted and the module cannot be uninstalled.
  3. Tried to delete all paragraph types, but fields cannot be deleted and the module cannot be uninstalled.

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?

s-jack’s picture

Category: Support request » Bug report

Uninstalled and verified the modules related to paragraphs.

  1. Paragraphs Editor Enhancements module uninstalled.
  2. The Paragraphs Features module was uninstalled.

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.

s-jack’s picture

Created 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.

sathishdevan made their first commit to this issue’s fork.

sathishdevan’s picture

Hi 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.

s-jack’s picture

Hi 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?"

sathishdevan’s picture

StatusFileSize
new5.74 KB

Hi 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.

sathishdevan’s picture

Status: Active » Needs review
sayco’s picture

Status: Needs review » Postponed (maintainer needs more info)
StatusFileSize
new6.94 MB

Hi, 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.

  • sayco committed ffa00fc3 on 3.x
    Issue #3441626 by sayco: Remove creating the field storage on module...
sayco’s picture

Status: Postponed (maintainer needs more info) » Fixed

I 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.

s-jack’s picture

Hi 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.

Status: Fixed » Closed (fixed)

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