function thunder_media_update_8012 in Thunder 8.2
Change preview image style for image media bundle to "medium" image style.
File
- modules/
thunder_media/ thunder_media.install, line 499 - Contains.
Code
function thunder_media_update_8012() {
/** @var \Drupal\update_helper\Updater $updater */
$updater = \Drupal::service('update_helper.updater');
$updateLogger = $updater
->logger();
// List of configurations that should be checked for existence.
$expectedConfig['content']['field_image']['settings']['preview_image_style'] = 'thumbnail';
// New configuration that should be applied.
$newConfig['content']['field_image']['settings']['preview_image_style'] = 'medium';
// Execute update of config with additional validation of existing config.
$updateExecuted = _thunder_media_update_config('core.entity_form_display.media.image.default', $newConfig, $expectedConfig);
// Log result of update.
if ($updateExecuted) {
$updateLogger
->info(t('Preview image style for image media bundle is successfully updated.'));
}
else {
$updateLogger
->warning(t('Unable to change preview image style for image media bundle.'));
}
// Output collected update log for UI update script.
return $updateLogger
->output();
}