4 * Contains \Drupal\bootstrap\Plugin\Preprocess\ProgressBar.
7 namespace Drupal\bootstrap\Plugin\Preprocess;
9 use Drupal\bootstrap\Annotation\BootstrapPreprocess;
10 use Drupal\bootstrap\Utility\Variables;
11 use Drupal\Component\Utility\Html;
14 * Pre-processes variables for the "progress_bar" theme hook.
16 * @ingroup plugins_preprocess
18 * @BootstrapPreprocess("progress_bar")
20 class ProgressBar extends PreprocessBase implements PreprocessInterface {
25 public function preprocessVariables(Variables $variables) {
26 // Ensure a unique ID, generating one if needed.
27 $id = $variables->getAttribute('id', Html::getUniqueId($variables->offsetGet('id', 'progress-bar')));
28 $variables->setAttribute('id', $id);
29 unset($variables['id']);
31 // Preprocess attributes.
32 $this->preprocessAttributes();