diff --git a/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc
index 0dff9f5..cfebfa6 100644
--- a/core/modules/ckeditor/ckeditor.admin.inc
+++ b/core/modules/ckeditor/ckeditor.admin.inc
@@ -8,7 +8,14 @@
 use Drupal\Core\Template\Attribute;
 
 /**
- * Preprocess variables for theme_ckeditor_settings_toolbar().
+ * Prepares variables for theme_ckeditor_settings_toolbar().
+ *
+ * Default template: ckeditor-settings-toolbar.html.twig.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - editor: An editor object.
+ *   - plugins: A list of plugins.
  */
 function template_preprocess_ckeditor_settings_toolbar(&$variables) {
   // Simplify the language direction information for toolbar buttons.
@@ -18,37 +25,34 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) {
   // Create lists of active and disabled buttons.
   $editor = $variables['editor'];
   $plugins = $variables['plugins'];
+
   $buttons = array();
-  $variables['multiple_buttons'] = array();
-  foreach ($plugins as $plugin => $plugin_buttons) {
+  $multiple_buttons = array();
+  $active_buttons  = array();
+
+  foreach ($plugins as $plugin_buttons) {
     foreach ($plugin_buttons as $button_name => $button) {
       $button['name'] = $button_name;
       if (!empty($button['multiple'])) {
-        $variables['multiple_buttons'][$button_name] = $button;
+        $multiple_buttons[$button_name] = $button;
       }
       $buttons[$button_name] = $button;
     }
   }
-  $variables['active_buttons'] = array();
+
   foreach ($editor->settings['toolbar']['buttons'] as $row_number => $row) {
     foreach ($row as $button_name) {
       if (isset($buttons[$button_name])) {
-        $variables['active_buttons'][$row_number][] = $buttons[$button_name];
+        $active_buttons[$row_number][] = $buttons[$button_name];
         if (empty($buttons[$button_name]['multiple'])) {
           unset($buttons[$button_name]);
         }
       }
     }
   }
-  $variables['disabled_buttons'] = array_diff_key($buttons, $variables['multiple_buttons']);
-}
 
-/**
- * Displays the toolbar configuration for CKEditor.
- */
-function theme_ckeditor_settings_toolbar($variables) {
-  $editor = $variables['editor'];
-  $plugins = $variables['plugins'];
+  $disabled_buttons = array_diff_key($buttons, $multiple_buttons);
+
   $rtl = $variables['language_direction'] === 'rtl' ? '_rtl' : '';
 
   $build_button_item = function($button, $rtl) {
@@ -57,7 +61,12 @@ function theme_ckeditor_settings_toolbar($variables) {
       $value = $button['image_alternative' . $rtl];
     }
     elseif (isset($button['image'])) {
-      $value = theme('image', array('uri' => $button['image' . $rtl], 'title' => $button['label']));
+      //$value = theme('image', array('uri' => $button['image' . $rtl], 'title' => $button['label']));
+      $value = array(
+        '#theme' => 'image',
+        '#uri' => $button['image' . $rtl],
+        '#title' => $button['label'],
+      );
     }
     else {
       $value = '?';
@@ -65,98 +74,39 @@ function theme_ckeditor_settings_toolbar($variables) {
 
     // Set additional attribute on the button if it can occur multiple times.
     if (!empty($button['multiple'])) {
-     $button['attributes']['class'][] = 'ckeditor-multiple-button';
+      $button['attributes']['class'][] = 'ckeditor-multiple-button';
     }
 
     // Build the button item.
-    $button_item = array(
-      'value' => $value,
+    $attributes = array(
       'data-button-name' => $button['name'],
     );
     if (!empty($button['attributes'])) {
-      $button_item = array_merge($button_item, $button['attributes']);
+      $attributes = array_merge($attributes, $button['attributes']);
     }
 
+    $button_item = array(
+      'value' => $value,
+      'attributes' => new Attribute($attributes),
+    );
     return $button_item;
   };
 
   // Assemble items to be added to active button rows.
-  $active_buttons = array();
-  foreach ($variables['active_buttons'] as $row_number => $row_buttons) {
+  $variables['active_buttons'] = array();
+  foreach ($active_buttons as $row_number => $row_buttons) {
     foreach ($row_buttons as $button) {
-      $active_buttons[$row_number][] = $build_button_item($button, $rtl);
+      $variables['active_buttons'][$row_number][] = $build_button_item($button, $rtl);
     }
   }
   // Assemble list of disabled buttons (which are always a single row).
-  $disabled_buttons = array();
-  foreach ($variables['disabled_buttons'] as $button) {
-    $disabled_buttons[] = $build_button_item($button, $rtl);
+  $variables['disabled_buttons'] = array();
+  foreach ($disabled_buttons as $button) {
+    $variables['disabled_buttons'][] = $build_button_item($button, $rtl);
   }
   // Assemble list of multiple buttons that may be added multiple times.
-  $multiple_buttons = array();
-  foreach ($variables['multiple_buttons'] as $button_name => $button) {
-    $multiple_buttons[] = $build_button_item($button, $rtl);
-  }
-
-  $print_buttons = function($buttons) {
-    $output = '';
-    foreach ($buttons as $button) {
-      $value = $button['value'];
-      unset($button['value']);
-      $attributes = (string) new Attribute($button);
-      $output .= '<li' . $attributes . '>' . $value . '</li>';
-    }
-    return $output;
-  };
-
-  // We don't use theme_item_list() below in case there are no buttons in the
-  // active or disabled list, as theme_item_list() will not print an empty UL.
-  $output = '';
-  $output .= '<fieldset role="form" aria-labelledby="ckeditor-button-configuration ckeditor-button-description">';
-  $output .= '<legend id="ckeditor-button-configuration">' . t('Toolbar configuration') . '</legend>';
-  $output .= '<div class="fieldset-wrapper">';
-
-  // aria-live region for outputing aural information about the state of the
-  // configuration.
-  $output .= '<div id="ckeditor-button-configuration-aria-live" class="element-invisible" aria-live="polite"></div>';
-
-  $output .= '<div id="ckeditor-button-description" class="fieldset-description">' . t('Move a button into the <em>Active toolbar</em> to enable it, or into the list of <em>Available buttons</em> to disable it. Use dividers to create button groups. Buttons may be moved with the mouse or keyboard arrow keys.') . '</div>';
-
-  $output .= '<div class="ckeditor-toolbar-disabled clearfix">';
-  $output .= '<div class="ckeditor-toolbar-dividers">';
-  $output .= '<label id="ckeditor-multiple-label">' . t('Dividers') . '</label>';
-  $output .= '<ul class="ckeditor-multiple-buttons" role="form" aria-labelledby="ckeditor-multiple-label">';
-  $output .= $print_buttons($multiple_buttons);
-  $output .= '</ul>';
-  $output .= '</div>';
-  $output .= '<label id="ckeditor-available-buttons">' . t('Available buttons') . '</label>';
-  $output .= '<ul class="ckeditor-buttons" role="form" aria-labelledby="ckeditor-available-buttons">';
-  $output .= $print_buttons($disabled_buttons);
-  $output .= '</ul>';
-  $output .= '</div>';
-
-  $output .= '<label id="ckeditor-active-toolbar">' . t('Active toolbar') . '</label>';
-
-  $output .= '<div data-toolbar="active" class="ckeditor-toolbar-active clearfix">';
-  foreach ($active_buttons as $button_row) {
-    $output .= '<ul class="ckeditor-buttons" role="form" aria-labelledby="ckeditor-active-toolbar">';
-    $output .= $print_buttons($button_row);
-    $output .= '</ul>';
-  }
-  if (empty($active_buttons)) {
-    $output .= '<ul class="ckeditor-buttons">';
-    $output .= '</ul>';
+  $variables['multiple_buttons'] = array();
+  foreach ($multiple_buttons as $button) {
+    $variables['multiple_buttons'][] = $build_button_item($button, $rtl);
   }
-
-  $output .= '<div class="ckeditor-row-controls">';
-  $output .= '<a href="#" role="button" aria-label="' . t('Remove last button row') . '" class="ckeditor-row-remove" title="' . t('Remove row') . '">-</a>';
-  $output .= '<a href="#" role="button" aria-label="' . t('Add additional button row') . '" class="ckeditor-row-add" title="' . t('Add row') . '">+</a>';
-  $output .= '</div>';
-
-  $output .= '</div>';
-
-  $output .= '</div>';
-  $output .= '</fieldset>';
-
-  return $output;
 }
diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module
index 506585d..e3b30d3 100644
--- a/core/modules/ckeditor/ckeditor.module
+++ b/core/modules/ckeditor/ckeditor.module
@@ -80,6 +80,7 @@ function ckeditor_theme() {
     'ckeditor_settings_toolbar' => array(
       'file' => 'ckeditor.admin.inc',
       'variables' => array('editor' => NULL, 'plugins' => NULL),
+      'template' => 'ckeditor-settings-toolbar',
     ),
   );
 }
diff --git a/core/modules/ckeditor/templates/ckeditor-settings-toolbar.html.twig b/core/modules/ckeditor/templates/ckeditor-settings-toolbar.html.twig
new file mode 100644
index 0000000..fce3f46
--- /dev/null
+++ b/core/modules/ckeditor/templates/ckeditor-settings-toolbar.html.twig
@@ -0,0 +1,69 @@
+{#
+/**
+ * @file
+ * Default theme implementation for the 'ckeditor_settings_toolbar' theme hook.
+ *
+ * Available variables:
+ * - multiple_buttons: A list of buttons that may be added multiple times.
+ * - disabled_buttons: A list of disabled buttons.
+ * - active_buttons: A list of active button rows.
+ *
+ * @see theme_preprocess()
+ * @see theme_preprocess_ckeditor_settings_toolbar()
+ *
+ * @themeable
+ */
+#}
+{% spaceless %}
+<fieldset role="form"
+          aria-labelledby="ckeditor-button-configuration ckeditor-button-description">
+  <legend
+      id="ckeditor-button-configuration">{{ 'Toolbar configuration'|t }}</legend>
+  <div class="fieldset-wrapper">
+    <div id="ckeditor-button-configuration-aria-live" class="element-invisible"
+         aria-live="polite"></div>
+    <div id="ckeditor-button-description"
+         class="fieldset-description">{{ 'Move a button into the <em>Active toolbar</em> to enable it, or into the list of <em>Available buttons</em> to disable it. Use dividers to create button groups. Buttons may be moved with the mouse or keyboard arrow keys.'|t }}</div>
+    <div class="ckeditor-toolbar-disabled clearfix">
+      <div class="ckeditor-toolbar-dividers">
+        <label id="ckeditor-multiple-label">{{ 'Dividers'|t }}</label>
+        <ul class="ckeditor-multiple-buttons" role="form"
+            aria-labelledby="ckeditor-multiple-label">
+          {% for multiple_button in multiple_buttons %}
+            <li{{ multiple_button.attributes }}>{{ multiple_button.value }}</li>
+          {% endfor %}
+        </ul>
+      </div>
+      <label id="ckeditor-available-buttons">{{ 'Available buttons'|t }}</label>
+      <ul class="ckeditor-buttons" role="form"
+          aria-labelledby="ckeditor-available-buttons">
+        {% for disabled_button in disabled_buttons %}
+           <li{{ disabled_button.attributes }}>{{ disabled_button.value }}</li>
+        {% endfor %}
+      </ul>
+    </div>
+    <label id="ckeditor-active-toolbar">{{ 'Active toolbar'|t }}</label>
+
+    <div data-toolbar="active" class="ckeditor-toolbar-active clearfix">
+      {% for button_row in active_buttons %}
+        <ul class="ckeditor-buttons" role="form"
+            aria-labelledby="ckeditor-active-toolbar">
+          {% for active_button in button_row %}
+            <li{{ active_button.attributes }}>{{ active_button.value }}</li>
+          {% endfor %}
+        </ul>
+      {% else %}
+        <ul class="ckeditor-buttons">
+        </ul>
+      {% endfor %}
+      <div class="ckeditor-row-controls">
+        <a href="#" role="button" aria-label="{{ 'Remove last button row'|t }}"
+           class="ckeditor-row-remove" title="{{ 'Remove row'|t }}">-</a>
+        <a href="#" role="button"
+           aria-label="{{ 'Add additional button row'|t }}"
+           class="ckeditor-row-add" title="{{ 'Add row'|t }}">+</a>
+      </div>
+    </div>
+  </div>
+</fieldset>
+{% endspaceless %}
