function content_browser_update_8001 in Content Browser 8
Updates entity browser configuration to remove outdated values.
File
- ./
content_browser.install, line 113 - Defines install routines for Content Browser.
Code
function content_browser_update_8001() {
/** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
$config_factory = \Drupal::service('config.factory');
$list = $config_factory
->listAll('entity_browser.browser');
foreach ([
'entity_browser.browser.browse_content_iframe',
'entity_browser.browser.browse_content',
] as $name) {
if (in_array($name, $list, TRUE)) {
$entity_browser = $config_factory
->getEditable($name);
if ($text = $entity_browser
->get('display_configuration.widget_ids')) {
$entity_browser
->clear('display_configuration.widget_ids');
}
if ($name === 'entity_browser.browser.browse_content') {
$entity_browser
->set('display_configuration.auto_open', FALSE);
}
$entity_browser
->save();
}
}
}