Issue #1939100 by chrisjlee, oriol_e9g, jenlampton: Convert theme_progress_bar() to Twig.
parent
0698191e66
commit
17c92fbf00
|
@ -2335,27 +2335,6 @@ function theme_more_link($variables) {
|
|||
return '<div class="more-link">' . l(t('More'), $variables['url'], array('attributes' => array('title' => $variables['title']))) . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = '<div id="progress" class="progress">';
|
||||
$output .= '<div class="progress__label">' . $variables['label'] . '</div>';
|
||||
$output .= '<div class="progress__track"><div class="progress__bar" style="width: ' . $variables['percent'] . '%"></div></div>';
|
||||
$output .= '<div class="progress__percentage">' . $variables['percent'] . '%</div>';
|
||||
$output .= '<div class="progress__description">' . $variables['message'] . '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
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),
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
#}
|
||||
<div id="progress" class="progress">
|
||||
{% if label %}
|
||||
<div class="progress__label">{{ label }}</div>
|
||||
{% endif %}
|
||||
<div class="progress__track"><div class="progress__bar" style="width: {{ percent }}%"></div></div>
|
||||
<div class="progress__percentage">{{ percent }}%</div>
|
||||
<div class="progress__description">{{ message }}</div>
|
||||
</div>
|
Loading…
Reference in New Issue