function share_everywhere_update_8004 in Share Everywhere 2.x
Same name and namespace in other branches
- 8 share_everywhere.install \share_everywhere_update_8004()
Update restricted pages config due to schema changes.
File
- ./
share_everywhere.install, line 62 - Install, update, and uninstall functions for the Share Everywhere module.
Code
function share_everywhere_update_8004() {
$config = \Drupal::configFactory()
->getEditable('share_everywhere.settings');
$restricted_pages = $config
->get('restricted_pages.pages');
if (!is_array($restricted_pages)) {
$restricted_pages = explode('\\r\\n', $restricted_pages);
foreach ($restricted_pages as $key => $page) {
if (empty($page)) {
unset($restricted_pages[$key]);
}
}
$config
->set('restricted_pages.pages', $restricted_pages)
->save();
}
}