1

I was following topic. I can including image style in my custom module. But I have a problem. I can't reinstall module because of following error:

Unable to install Module ABC, image.style.black_white already exists in active configuration.

Can I include an image style in custom module with file config and maybe reinstall module?

4

Your problem is don't delete image style when uninstall module. So when you reinstall image style already exist. Use can use hook_uninstall to delete image style to finish uninstall: write code in file module_name.install

<?php
use Drupal\image\Entity\ImageStyle;

function module_name_uninstall() {

  ImageStyle::load('image_style_name')->delete();

}
2

I think you are trying to add a new image style 'black_white' but an image style with the same name already exist.

Solution 1. Delete the image style 'black_white' from /admin/config/media/image-styles.

Solution 2. If your module has a image style configuration file "image.style.black_white.yml" Check or Remove it. Have you already installed / uninstalled the module ?

If you have already install/uninstall this module, try to review uninstall processes to clean up properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy