The progress bar is not reversed when the website is in RTL.

CommentFileSizeAuthor
#2 webform_progress_rtl-2211009.patch1.16 KBquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heyyo’s picture

I just modified webform-progressbar.tpl.php file to make it work for LTR and RTL languages.

<?php
/**
 * @file
 * Display the progress bar for multipage forms
 *
 * Available variables:
 * - $node: The webform node.
 * - $progressbar_page_number: TRUE if the actual page number should be
 *   displayed.
 * - $progressbar_percent: TRUE if the percentage complete should be displayed.
 * - $progressbar_bar: TRUE if the bar should be displayed.
 * - $progressbar_pagebreak_labels: TRUE if the page break labels shoud be
 *   displayed.

 * - $page_num: The current page number.
 * - $page_count: The total number of pages in this form.
 * - $page_labels: The labels for the pages. This typically includes a label for
 *   the starting page (index 0), each page in the form based on page break
 *   labels, and then the confirmation page (index number of pages + 1).
 * - $percent: The percentage complete.
 */
?>
<div class="webform-progressbar">
  <?php global $language; if ($progressbar_bar): ?>
    <div class="webform-progressbar-outer">
      <div class="webform-progressbar-inner" style="width: <?php print number_format($percent, 0); ?>%">&nbsp;</div>
      <?php for ($n = 1; $n <= $page_count; $n++): ?>
        <span class="webform-progressbar-page<?php if ($n < $page_num) { print ' completed'; }; ?><?php if ($n == $page_num) { print ' current'; }; ?>" style="<?php if ($language->direction == 0) { print "left: "; } else { print "right: ";} ?><?php print number_format(($n - 1) / ($page_count - 1), 4) * 100; ?>%">
          <span class="webform-progressbar-page-number"><?php print $n; ?></span>
          <?php if ($progressbar_pagebreak_labels): ?>
          <span class="webform-progressbar-page-label">
            <?php print check_plain($page_labels[$n - 1]); ?>
          </span>
          <?php endif; ?>
        </span>
      <?php endfor; ?>
    </div>
  <?php endif; ?>


  <?php if ($progressbar_page_number): ?>
    <div class="webform-progressbar-number">
      <?php print t('Page @start of @end', array('@start' => $page_num, '@end' => $page_count)); ?>
      <?php if ($progressbar_percent): ?>
        <span class="webform-progressbar-number">
          (<?php print number_format($percent, 0); ?>%)
        </span>
      <?php endif; ?>
    </div>
  <?php endif; ?>

  <?php if (!$progressbar_page_number && $progressbar_percent): ?>
    <div class="webform-progressbar-number">
      <?php print number_format($percent, 0); ?>%
    </div>
  <?php endif; ?>
</div>

?>
quicksketch’s picture

Status: Active » Needs review
FileSize
1.16 KB

Thanks @heyyo, I adapted your suggestion into a patch.

  • Commit 180075a on 7.x-4.x by quicksketch:
    Issue #2211009: Make progress bar support RTL languages.
    
quicksketch’s picture

Status: Needs review » Fixed

Pushed to 7.x-4.x.

Status: Fixed » Needs work

The last submitted patch, 2: webform_progress_rtl-2211009.patch, failed testing.

quicksketch’s picture

Status: Needs work » Fixed

This is unrelated to the test failures (which were fixed in later RC releases anyway).

fenstrat’s picture

Version: 7.x-4.0-beta3 » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Fixed » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.0-beta3
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed to 8.x-4.x. Thanks!

  • Commit f0e9d7d on 8.x-4.x by fenstrat:
    Issue #2211009 by quicksketch | heyyo: Make progress bar support RTL...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.