function imageapi_optimize_update_8002 in Image Optimize (or ImageAPI Optimize) 8.2
Same name and namespace in other branches
- 8.3 imageapi_optimize.install \imageapi_optimize_update_8002()
- 4.x imageapi_optimize.install \imageapi_optimize_update_8002()
Update misnamed config entites.
File
- ./
imageapi_optimize.install, line 31 - Install and update functions for the Image Optimize module.
Code
function imageapi_optimize_update_8002() {
$config_factory = \Drupal::configFactory();
$config_list = $config_factory
->listAll('imageapi_optimize.processor.');
foreach ($config_list as $config_key) {
$config = $config_factory
->getEditable($config_key);
// Store the raw data for re-saving.
$data = $config
->getRawData();
// Our config entity prefix changes from processor to pipeline.
$new_name = 'imageapi_optimize.pipeline.' . substr($config_key, strlen('imageapi_optimize.processor.'));
$config
->delete()
->setName($new_name)
->setData($data)
->save(TRUE);
}
}