function contact_storage_update_8200 in Contact Storage 8
Updates the redirect paths to the core property redirect path.
File
- ./
contact_storage.install, line 101 - Contains install and update hooks.
Code
function contact_storage_update_8200() {
$config_factory = \Drupal::configFactory();
// Iterate on all text formats config entities.
foreach ($config_factory
->listAll('contact.form.') as $name) {
if ($redirect_page = $config_factory
->get($name)
->get('third_party_settings.contact_storage.redirect_uri')) {
$config = $config_factory
->getEditable($name);
$config
->clear('third_party_settings.contact_storage.redirect_uri');
try {
$url = '/' . Url::fromUri($redirect_page)
->getInternalPath();
} catch (Exception $e) {
continue;
}
if (!$config
->get('redirect')) {
$config
->set('redirect', $url);
}
$config
->save();
}
}
}