function thunder_update_8117 in Thunder 8.2
Enable paragraphs split text.
File
- ./
thunder.install, line 764 - Install, update and uninstall functions for the thunder installation profile.
Code
function thunder_update_8117() {
/** @var \Drupal\update_helper\Updater $updater */
$updater = \Drupal::service('update_helper.updater');
/** @var \Drupal\update_helper\UpdateLogger $updateLogger */
$updateLogger = $updater
->logger();
if (!$updater
->executeUpdate('thunder', 'thunder__thunder_update_8117')) {
return $updateLogger
->output();
}
// Set split text functionality for basic html CKEditor mode.
$config = \Drupal::configFactory()
->getEditable('editor.editor.basic_html');
$items = $config
->get('settings.toolbar.rows.0');
if ($items) {
foreach ($items as &$item) {
if (!empty($item['name'] && $item['name'] === 'Tools')) {
$item['items'][] = 'SplitTextBefore';
}
}
$config
->set('settings.toolbar.rows.0', $items)
->save();
}
else {
// TODO: Check logic for this ESLE!!!
$updateLogger
->warning('Unable to setup split text functionality for paragraphs.');
_thunder_mark_update_checklist('thunder__thunder_update_8117', FALSE, $updateLogger);
}
// Output logged messages to related channel of update execution.
return $updateLogger
->output();
}