Jelajahi Sumber

Ticket #1211 - Feature itself.

AntonLV 8 tahun lalu
induk
melakukan
024c4757e3

+ 20 - 0
inc/classes/BxDolScore.php

@@ -270,6 +270,26 @@ class BxDolScore extends BxDolObject
         ));
     }
 
+    /**
+     * Note. By default image based controls aren't used.
+     * Therefore it can be overwritten in custom template.
+     */
+    protected function _getImageDo($sType)
+    {
+        $sResult = '';
+
+        switch($sType) {
+            case BX_DOL_SCORE_DO_UP:
+                $sResult = '';
+                break;
+            case BX_DOL_SCORE_DO_DOWN:
+                $sResult = '';
+                break;
+        }
+
+    	return $sResult;
+    }
+
     protected function _getIconDo($sType)
     {
         $sResult = '';

+ 1 - 1
template/score_do_vote_label.html

@@ -1 +1 @@
-<bx_if:show_icon><i class="sys-icon __name__"></i></bx_if:show_icon><bx_if:show_text><span class="bx-def-margin-sec-left-auto">__text__</span></bx_if:show_text>
+<bx_if:show_image><img src="__src__" /></bx_if:show_image><bx_if:show_icon><i class="sys-icon __name__"></i></bx_if:show_icon><bx_if:show_text><span class="bx-def-margin-sec-left-auto">__text__</span></bx_if:show_text>

+ 7 - 0
template/scripts/BxBaseScore.php

@@ -48,6 +48,7 @@ class BxBaseScore extends BxDolScore
         $this->_aElementDefaults = array(
             'show_do_vote_as_button' => false,
             'show_do_vote_as_button_small' => false,
+            'show_do_vote_image' => false,
             'show_do_vote_icon' => true,
             'show_do_vote_label' => false,
             'show_counter' => true,
@@ -300,6 +301,12 @@ class BxBaseScore extends BxDolScore
     protected function _getLabelDo($sType, $aParams = array())
     {
         return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentDoVoteLabel, array(
+        	'bx_if:show_image' => array(
+        		'condition' => isset($aParams['show_do_vote_image']) && $aParams['show_do_vote_image'] == true,
+        		'content' => array(
+        			'src' => $this->_getImageDo($sType)
+        		)
+        	),
         	'bx_if:show_icon' => array(
         		'condition' => isset($aParams['show_do_vote_icon']) && $aParams['show_do_vote_icon'] == true,
         		'content' => array(