Cannot uninstall module.

Created on 17 April 2024, 7 months ago
Updated 28 May 2024, 6 months ago

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

๐Ÿ› Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

๐Ÿ‡ฏ๐Ÿ‡ตJapan s-jack Tokyo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @s-jack
  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan s-jack Tokyo

    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?

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan s-jack Tokyo

    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.

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan s-jack Tokyo

    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.

  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sathishdevan

    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.

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan s-jack Tokyo

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sathishdevan

    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.

  • Status changed to Needs review 6 months ago
  • Status changed to Postponed: needs info 6 months ago
  • ๐Ÿ‡ต๐Ÿ‡ฑPoland sayco Toruล„

    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...
  • Status changed to Fixed 6 months ago
  • ๐Ÿ‡ต๐Ÿ‡ฑPoland sayco Toruล„

    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.

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan s-jack Tokyo

    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.

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

Production build 0.71.5 2024