Commit 841be6ba authored by catch's avatar catch

Issue #2696771 by Wim Leers, thpoul: Minor clean-up of...

Issue #2696771 by Wim Leers, thpoul: Minor clean-up of \Drupal\ckeditor\Plugin\CKEditorPlugin\Internal::getConfig()
parent 0905f0f7
......@@ -4,7 +4,7 @@
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\ckeditor\CKEditorPluginManager;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
......@@ -113,14 +113,7 @@ public function getConfig(Editor $editor) {
list($config['allowedContent'], $config['disallowedContent']) = $this->generateACFSettings($editor);
// Add the format_tags setting, if its button is enabled.
$toolbar_rows = array();
$settings = $editor->getSettings();
foreach ($settings['toolbar']['rows'] as $row_number => $row) {
$toolbar_rows[] = array_reduce($settings['toolbar']['rows'][$row_number], function (&$result, $button_group) {
return array_merge($result, $button_group['items']);
}, array());
}
$toolbar_buttons = array_unique(NestedArray::mergeDeepArray($toolbar_rows));
$toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor);
if (in_array('Format', $toolbar_buttons)) {
$config['format_tags'] = $this->generateFormatTagsSetting($editor);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment