summaryrefslogtreecommitdiff
path: root/views/mods/mod_reviews/rating.phtml
diff options
context:
space:
mode:
Diffstat (limited to 'views/mods/mod_reviews/rating.phtml')
-rw-r--r--views/mods/mod_reviews/rating.phtml13
1 files changed, 13 insertions, 0 deletions
diff --git a/views/mods/mod_reviews/rating.phtml b/views/mods/mod_reviews/rating.phtml
new file mode 100644
index 0000000..5aa665b
--- /dev/null
+++ b/views/mods/mod_reviews/rating.phtml
@@ -0,0 +1,13 @@
+<?php
+ /**
+ * Sterne mit Schnitt und Anzahl (Modul Produktbewertungen)
+ *
+ * Die Sternzeichen sind aria-hidden, den Wert sagt der Text. Modus full: Text sichtbar; compact: sichtbar „4,5 (12)“,
+ * der ganze Text für Screenreader; single: nur Sterne, der Text für Screenreader.
+ * @version 4.6.1
+ */
+ defined('ABSPATH') || exit;
+
+ $r = $this->view['wpsg_mod_reviews']['rating'];
+?>
+<p class="wpsg-rating<?php if ($r['class'] !== '') echo ' '.esc_attr($r['class']); ?>"><span class="wpsg-rating__stars" aria-hidden="true"><span class="wpsg-rating__empty">★★★★★</span><span class="wpsg-rating__fill" style="width:<?php echo intval($r['percent']); ?>%">★★★★★</span></span><?php if ($r['mode'] === 'full') { ?> <span class="wpsg-rating__text"><?php echo esc_html($r['text']); ?></span><?php } else if ($r['mode'] === 'compact') { ?> <span class="wpsg-rating__text" aria-hidden="true"><?php echo esc_html($r['short']); ?></span><span class="screen-reader-text"><?php echo esc_html($r['text']); ?></span><?php } else { ?><span class="screen-reader-text"><?php echo esc_html($r['text']); ?></span><?php } ?></p>