function lightning_media_update_8009 in Lightning Media 8.4
Same name and namespace in other branches
- 8 lightning_media.install \lightning_media_update_8009()
- 8.2 lightning_media.install \lightning_media_update_8009()
- 8.3 lightning_media.install \lightning_media_update_8009()
Changes the media_library CKEditor button to media_browser.
File
- ./
lightning_media.install, line 149 - Contains install and update routines for Lightning Media.
Code
function lightning_media_update_8009() {
/** @var \Drupal\editor\EditorInterface $editor */
$editor = Editor::load('rich_text');
if ($editor) {
$settings = $editor
->getSettings();
foreach ($settings['toolbar']['rows'] as &$row) {
foreach ($row as &$group) {
$index = array_search('media_library', $group['items']);
if ($index !== FALSE) {
$group['items'][$index] = 'media_browser';
}
}
}
$editor
->setSettings($settings)
->save();
}
}