Builds the "toolbar" configuration part of the CKEditor JS settings.
\Drupal\editor\Plugin\Core\Entity\Editor $editor: A configured text editor object.
array An array containing the "toolbar" configuration.
getJSSettings()
public function buildToolbarJSSetting(EditorEntity $editor) {
$toolbar = array();
foreach ($editor->settings['toolbar']['buttons'] as $row_number => $row) {
$button_group = array();
foreach ($row as $button_name) {
// Change the toolbar separators into groups.
if ($button_name === '|') {
$toolbar[] = $button_group;
$button_group = array();
}
else {
$button_group['items'][] = $button_name;
}
}
$toolbar[] = $button_group;
$toolbar[] = '/';
}
return $toolbar;
}