function fillpdf_update_8107 in FillPDF 8.4
Same name and namespace in other branches
- 5.0.x fillpdf.install \fillpdf_update_8107()
Update storage scheme configuration.
File
- ./
fillpdf.install, line 141 - Install functions for FillPDF.
Code
function fillpdf_update_8107() {
$config = \Drupal::configFactory()
->getEditable('fillpdf.settings');
// Rename the 'scheme' key to 'template_scheme'.
if ($config
->get('template_scheme') === NULL) {
$config
->set('template_scheme', $config
->get('scheme'));
}
$config
->clear('scheme');
// Initialize the new 'allowed_schemes' key with all currently available
// storage schemes.
if ($config
->get('allowed_schemes') === NULL) {
$available_schemes = array_keys(\Drupal::service('stream_wrapper_manager')
->getWrappers(StreamWrapperInterface::WRITE_VISIBLE));
$config
->set('allowed_schemes', $available_schemes)
->save();
}
$config
->save();
return new FormattableMarkup('All currently available file storage schemes were added to FillPDF configuration. Please review at <a href=":url">FillPDF settings</a>.', [
':url' => Url::fromRoute('fillpdf.settings')
->setOption('base_url', \Drupal::request()
->getBasePath())
->toString(),
]);
}