diff --git a/core/includes/theme.inc b/core/includes/theme.inc index da3df24cc79..f5b79e8e2a9 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2335,27 +2335,6 @@ function theme_more_link($variables) { return ''; } -/** - * Returns HTML for a progress bar. - * - * Note that the core Batch API uses this only for non-JavaScript batch jobs. - * - * @param $variables - * An associative array containing: - * - percent: The percentage of the progress. - * - message: A string containing information to be displayed. - */ -function theme_progress_bar($variables) { - $output = '
'; - $output .= '
' . $variables['label'] . '
'; - $output .= '
'; - $output .= '
' . $variables['percent'] . '%
'; - $output .= '
' . $variables['message'] . '
'; - $output .= '
'; - - return $output; -} - /** * Returns HTML for an indentation div; used for drag and drop tables. * @@ -3074,7 +3053,8 @@ function drupal_common_theme() { 'variables' => array('url' => NULL, 'title' => NULL) ), 'progress_bar' => array( - 'variables' => array('percent' => NULL, 'message' => NULL), + 'variables' => array('label' => NULL, 'percent' => NULL, 'message' => NULL), + 'template' => 'progress-bar', ), 'indentation' => array( 'variables' => array('size' => 1), diff --git a/core/modules/system/templates/progress-bar.html.twig b/core/modules/system/templates/progress-bar.html.twig new file mode 100644 index 00000000000..0d11991d347 --- /dev/null +++ b/core/modules/system/templates/progress-bar.html.twig @@ -0,0 +1,23 @@ +{# +/** + * @file + * Default theme implementation for a progress bar. + * + * Note that the core Batch API uses this only for non-JavaScript batch jobs. + * + * Available variables: + * - label: The label of the working task. + * - percent: The percentage of the progress. + * - message: A string containing information to be displayed. + * + * @ingroup themeable + */ +#} +
+ {% if label %} +
{{ label }}
+ {% endif %} +
+
{{ percent }}%
+
{{ message }}
+