field_image_browser field is not uninstalled when uninstalling Entity Browser example module.
If you try to install the module again you get an error:
Unable to install Entity Browser example, field.storage.node.field_image_browser already exists in active configuration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nor4a created an issue. See original summary.

MarkoT91’s picture

Assigned: Unassigned » MarkoT91
alex_optim’s picture

Assigned: MarkoT91 » alex_optim
alex_optim’s picture

Assigned: alex_optim » Unassigned
Status: Active » Needs review
FileSize
95.27 KB

Renamed folder and added one configuration.

slashrsm’s picture

Status: Needs review » Needs work
Issue tags: +D8Media

Please create a patch that shows renames instead of removes and adds.

+++ b/modules/example/config/optional/core.entity_view_mode.node.teaser.yml
@@ -0,0 +1,12 @@
+uuid: 12930220-2158-4b49-806e-985a9db90735
+langcode: en
+status: true
+dependencies:
+  module:
+    - node
+_core:
+  default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4
+id: node.teaser
+label: Teaser
+targetEntityType: node
+cache: false

I am not sure if we want to do this. This view mode is already shipped by the node module.

alex_optim’s picture

Assigned: Unassigned » alex_optim
alex_optim’s picture

alex_optim’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: already_exist_in_active_configuration-2824352-7.patch, failed testing.

slashrsm’s picture

Priority: Normal » Minor
Status: Needs work » Needs review
Issue tags: +Needs tests, +Novice
FileSize
2.47 KB

Looked into this a bit more. The attached patch doesn't fix the actual problem; rather it avoids it on the second install. The problem is that the field isn't removed on uninstall. Attached patch ensures it is.

It would be also nice to add an automated test that would cover this case.

alex_optim’s picture

Assigned: alex_optim » Unassigned
SocialNicheGuru’s picture

I enabled entity_browser_example.
I disabled it
then I tried to disable entity_browser.

drush pm-uninstall entity_browser -y
The following extensions will be uninstalled: entity_browser
Do you really want to continue? (y/n): y
Drupal\Core\Field\FieldException: Attempt to create a field field_files that does not exist on entity type node. in [error]
drupal-8.4.2/html/core/modules/field/src/Entity/FieldConfig.php:293

drush cr did not help

This patch is necessary.

I went back and re-installed entity_browser_example and then uninstalled it and then uninstalled entity_browser.
It worked.

Otherwise I get this error when trying to uninstall entity_browser (2.x)

Venkatesh Rajan.J’s picture

Assigned: Unassigned » Venkatesh Rajan.J
Venkatesh Rajan.J’s picture

Status: Needs review » Needs work
FileSize
59.08 KB

#10 did not work for me too. The field_image_browser field is not removed even after applying the patch. Errors are thrown when we try to reinstall entity browser example module. Refer the attachment

Venkatesh Rajan.J’s picture

Assigned: Venkatesh Rajan.J » Unassigned
dakku’s picture

I recenetly had the same issue on https://www.drupal.org/project/media_entity_flickr:

What I implemented instead is something like:

/**
 * Implements hook_uninstall().
 */
function media_entity_flickr_uninstall() {
  // Delete the field storage. If not removed it will give the following error.
  // exception Drupal\Core\Config\PreExistingConfigException
  Drupal::configFactory()->getEditable('field.storage.media.field_media_flickr')->delete();
}
Ivan Berezhnov’s picture

Issue tags: +CSKyiv18
guilhermevp’s picture

Status: Needs work » Needs review
FileSize
741 bytes

Created a hook to remove conflicting fields.

Dave Reid’s picture

Should this go in entity_browser_example.install instead of entity_browser.install so that it actually gets run when the entity_browser_example module is uninstalled?

guilhermevp’s picture

Assigned: Unassigned » guilhermevp

Edited.

guilhermevp’s picture

Assigned: guilhermevp » Unassigned
guilhermevp’s picture

FileSize
710 bytes

Sending patch addressing #19.

rukayya’s picture

Assigned: Unassigned » rukayya
rukayya’s picture

Status: Needs review » Reviewed & tested by the community

#22 working fine for me.

Berdir’s picture

Status: Reviewed & tested by the community » Needs work

Deleting field config with low-level config API is wrong and will break stuff.

The correct way to do it is to add an explicit config dependency on the module to those config files like most config files already have.

jmizarela’s picture

Assigned: rukayya » jmizarela

I'll try to make something like patch #10 work, considering #19 and following advice from #25.

jmizarela’s picture

Assigned: jmizarela » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.1 KB

Patch adds both field storage config deletes on uninstall, for field_files_over_ajax and field_image_browser.
You can check it that it now shows on "Configuration deletions" when you "Confirm the uninstallation" like follows:
...
Field storage

  • node.field_files
  • node.field_files1
  • node.field_files_over_ajax
  • node.field_image_browser
  • node.field_nodes

...

This patch prevents the problem, it doesn't fix it for people who already have it... if that is your case, just delete the configs manually.
So, for reviewing/testing, PLEASE MAKE SURE you are doing it from a FRESH entity_browser install or that you manually deleted the configs that weren't deleted on the entity_browser_example uninstallation.
I don't think it actually needs testing besides manual testing, but I'd love to learn why that is an incorrect assumption.
Cheers!

kenyoOwen’s picture

Status: Needs review » Needs work
FileSize
28.55 KB

Hi jmizarela,

I'm new to this module and applied patch #27 to the Entity Browser against 8.x-1.x-dev and I can't see the node.field_files_over_ajax
node.field_image_browser even with the patch.

Please see screenshot attached.

Thank You.

kenyoOwen’s picture