EBT Settings field prevents uninstall of ebt_core

Created on 19 February 2023, almost 2 years ago
Updated 27 August 2024, 4 months ago

I am unable to uninstall ebt_core. It reports:

The following reason prevents Extra Block Types (EBT): Core from being uninstalled:
The EBT Settings field type is used in the following field: block_content.field_ebt_settings

/admin/reports/fields reports that block_content.field_ebt_settings is not being used.

To repeat install ebt_core on fresh D9 install. Navigate to /admin/modules/uninstall and observe warning above.

Steps to reproduce

  1. Run composer require 'drupal/ebt_core:^1.4'
  2. Run drush en ebt_core -y
  3. Run drush pmu ebt_core -y
  4. Result: ebt_core: The <em class="placeholder">EBT Settings</em> field type is used in the following field: block_content.field_ebt_settings
πŸ› Bug report
Status

Fixed

Version

1.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Dave Kopecek

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @Dave Kopecek
  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia

    Hi Dave Kopecek, EBT modules can't remove content automatically. At least I couldn't find to do it in right way. Because we need to remove Block Type and all blocks for this block types.
    If you used any EBT blocks in Layout Builder, you should remove them first from Layout Builder pages and run cron after that. Layout Builder pages will be broken if inline block will be deleted before deleting from Layout Builder pages.

    I wanted to say you need to remove all EBT blocks and then EBT block types manually, run cron, remove all other EBT modules and then you will be able to remove EBT Core module.

    I started to work on EBT blocks documentation:
    https://drupalbook.org/ebt

    If you have any questions feel free to write it here or create new issue on drupal.org. Thank you, for using EBT modules!

  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia
  • πŸ‡ΊπŸ‡ΈUnited States Dave Kopecek

    >> I wanted to say you need to remove all EBT blocks and then EBT block types manually, run cron, remove all other EBT modules and then you will be able to remove EBT Core module.

    This happens on a clean D9 install after just installing ebt_core & no other modules. Once it's installed it can't be uninstalled. No content has been created. EBT_core installs block_content.field_ebt_settings. It shows up in the field list, but not in the block UI.

    Where exactly to I remove the block_content.field_ebt_settings? I don't see it listed anywhere. Am I missing something?

  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia

    Oh, I see... EBT Core adds only field storage for field_ebt_settings without field instance and there is no way to remove field storage without field instance. Kind of wierd workflow for Drupal, but it's an idea of EBT modules: EBT Core have common settings like field storage and field widget, and other EBT modules have field instances for using EBT settings.

    I have two suggestions for you:
    1. If you exported configs, then try to remove field.storage.block_content.field_ebt_settings.yml and import configs again without it.
    2. Install any other EBT Module, then you will have field instance for field_ebt_settings field storage. And then remove new added EBT block type with field instance for field_ebt_settings. It will cause removing field instance and field storage both.

    I don't know, should I implement something to remove orphan field storage. I'm having look this solution:
    https://www.drupal.org/project/drupal/issues/3231028 β†’

  • πŸ‡ΊπŸ‡ΈUnited States w01f

    Same problem, decided not to use this module (at least not yet) for a project I was testing it on and not it won't remove. I can see the ebt config files in the single export browser, but is there an easier way to remove these?

  • πŸ‡·πŸ‡ΈSerbia levmyshkin Novi Sad, Serbia
  • πŸ‡§πŸ‡·Brazil renatog Campinas

    I was able to reproduce it in a fresh install, only installing and after that uninstalling. So updated the issue summary with a section "steps to reproduce"

    I didn't find the final fix yet but I'm putting here the steps just to help

  • πŸ‡§πŸ‡·Brazil renatog Campinas
  • πŸ‡ΊπŸ‡ΈUnited States peter pulsifer

    I struggled with this same issue. I installed EBT but could not install the EBT Starterkit because it requires Drush 12+. So I never added any EBT content. The EBT Core Remove Helper had no effect - it reported correctly that there was no EBT content to delete, and "Remove EBT Settings Field Storage" resulted in no change.

    Looking at EbtRemoveHelperForm.php, I see that in my case at least,

    $field_storage = \Drupal::entityTypeManager()->getStorage('field_storage_config')->load('field_ebt_settings');
    

    gives no results ($field_storage is null).

    What did work is

    $field_storages = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(['module' => 'ebt_core']);
    foreach ($field_storages as $field_storage) $field_storage->delete();
    

    So loading the field storage by module instead of by name was the way to go for me.

Production build 0.71.5 2024