function thunder_update_8128 in Thunder 8.2
Set metatag fields translatable per default.
File
- ./
thunder.install, line 1023 - Install, update and uninstall functions for the thunder installation profile.
Code
function thunder_update_8128() {
/** @var \Drupal\update_helper\Updater $updater */
$updater = \Drupal::service('update_helper.updater');
$updateLogger = $updater
->logger();
$successfulUpdate = TRUE;
$config_ids = [
'node.article.field_meta_tags',
'taxonomy_term.channel.field_meta_tags',
'taxonomy_term.tags.field_meta_tags',
];
foreach ($config_ids as $config_id) {
$config = FieldConfig::load($config_id);
if ($config) {
$config
->setTranslatable(TRUE)
->save();
$updateLogger
->info(t('Translation is successfully enabled for @config_id configuration.', [
'@config_id' => $config_id,
]));
}
else {
$successfulUpdate = FALSE;
$updateLogger
->warning(t('Unable to load @config_id configuration.', [
'@config_id' => $config_id,
]));
}
}
_thunder_mark_update_checklist('thunder__thunder_update_8128', $successfulUpdate, $updateLogger);
// Output logged messages to related channel of update execution.
return $updateLogger
->output();
}