You are here

function imageapi_optimize_update_8001 in Image Optimize (or ImageAPI Optimize) 4.x

Same name and namespace in other branches
  1. 8.3 imageapi_optimize.install \imageapi_optimize_update_8001()
  2. 8.2 imageapi_optimize.install \imageapi_optimize_update_8001()

Remove previously invalid config entities.

File

./imageapi_optimize.install, line 11
Install and update functions for the Image Optimize module.

Code

function imageapi_optimize_update_8001() {
  $config_factory = \Drupal::configFactory();

  // These were mis-named, so can never have been in-use by anyone.
  $legacy_pipelines = [
    'imageapi_optimize.pipeline.resmushit',
    'imageapi_optimize.pipeline.local_binaries',
  ];
  foreach ($legacy_pipelines as $legacy_pipeline) {
    $config_list = $config_factory
      ->listAll($legacy_pipeline);
    foreach ($config_list as $config_key) {
      $config = $config_factory
        ->getEditable($config_key);

      // Remove the old config entity.
      $config
        ->delete();
    }
  }
}