function thunder_update_8006 in Thunder 8.2
Adds instagram preview mode.
File
- ./
thunder.install, line 294 - Install, update and uninstall functions for the thunder installation profile.
Code
function thunder_update_8006() {
/** @var \Drupal\update_helper\UpdateLogger $updateLogger */
$updateLogger = \Drupal::service('update_helper.logger');
$configs = [
'entity_view_display' => [
'paragraph.instagram.preview',
'media.instagram.thumbnail',
],
];
/** @var Drupal\config_update\ConfigRevertInterface $configReverter */
$configReverter = \Drupal::service('config_update.config_update');
// Ensure that required view mode exists.
if (empty($configReverter
->getFromActive('entity_view_mode', 'media.thumbnail'))) {
$configReverter
->import('entity_view_mode', 'media.thumbnail');
}
// Import listed configurations.
foreach ($configs as $entity => $ids) {
foreach ($ids as $id) {
try {
$configReverter
->import($entity, $id);
} catch (\Exception $e) {
$updateLogger
->warning(t('Unable to import @entity.@id config.', [
'@id' => $id,
'@entity' => $entity,
]));
}
}
}
return $updateLogger
->output();
}