Explorar el Código

Ticket #5172 - Get rid of duplicates in code. Icon preview.

AntonLV hace 1 año
padre
commit
08ca915c8e

+ 0 - 31
studio/template/scripts/BxBaseStudioBadgesGrid.php

@@ -440,36 +440,5 @@ class BxBaseStudioBadgesGrid extends BxDolStudioBadgesGrid
         
         return new BxTemplStudioFormView($aForm);
     }
-    
-    protected function _getIconPreview($iId, $sIconImage = '', $sIcon = '')
-    {
-        $bIconImage = !empty($sIconImage);
-		
-        $aIcons = BxTemplFunctions::getInstanceWithTemplate($this->_oTemplate)->getIcon($sIcon);
-        $sIconHtml = $aIcons[2] . $aIcons[3] . $aIcons[4];
-		$bIconHtml = !empty($sIconHtml) && !$bIconImage;
-		
-        return $this->_oTemplate->parseHtmlByName('item_icon_preview.html', array(
-            'id' => $iId,
-            'bx_if:show_icon_empty' => array(
-                'condition' => !$bIconImage && !$bIconHtml,
-                'content' => array()
-            ),
-            'bx_if:show_icon_image' => array(
-                'condition' => $bIconImage,
-                'content' => array(
-                    'js_object' => $this->getJsObject(),
-                    'url' => $sIconImage,
-                    'id' => $iId
-                )
-            ),
-            'bx_if:show_icon_html' => array(
-                'condition' => $bIconHtml,
-                'content' => array(
-                    'icon' => $sIconHtml
-                )
-            )
-        ));
-    }
 }
 /** @} */

+ 31 - 0
studio/template/scripts/BxBaseStudioGrid.php

@@ -72,6 +72,37 @@ class BxBaseStudioGrid extends BxDolStudioGrid
 
         return $aItem;
     }
+
+    protected function _getIconPreview($iId, $sIconImage = '', $sIcon = '')
+    {
+        $bIconImage = !empty($sIconImage);
+
+        $aIcons = BxTemplFunctions::getInstanceWithTemplate($this->_oTemplate)->getIcon($sIcon);
+        $sIconHtml = $aIcons[2] . $aIcons[3] . $aIcons[4];
+        $bIconHtml = !empty($sIconHtml) && !$bIconImage;
+
+        return $this->_oTemplate->parseHtmlByName('item_icon_preview.html', [
+            'id' => $iId,
+            'bx_if:show_icon_empty' => [
+                'condition' => !$bIconImage && !$bIconHtml,
+                'content' => []
+            ],
+            'bx_if:show_icon_image' => [
+                'condition' => $bIconImage,
+                'content' => [
+                    'js_object' => $this->getJsObject(),
+                    'url' => $sIconImage,
+                    'id' => $iId
+                ]
+            ],
+            'bx_if:show_icon_html' => [
+                'condition' => $bIconHtml,
+                'content' => [
+                    'icon' => $sIconHtml
+                ]
+            ]
+        ]);
+    }
 }
 
 /** @} */

+ 0 - 31
studio/template/scripts/BxBaseStudioPermissionsLevels.php

@@ -319,37 +319,6 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
         return  parent::_getActionDefault($sType, $sKey, $a, false, $isDisabled, $aRow);
     }
 
-    protected function _getIconPreview($iId, $sIconImage = '', $sIcon = '')
-    {
-        $bIconImage = !empty($sIconImage);
-		
-        $aIcons = BxTemplFunctions::getInstanceWithTemplate($this->_oTemplate)->getIcon($sIcon);
-        $sIconHtml = $aIcons[2] . $aIcons[3] . $aIcons[4];
-		$bIconHtml = !empty($sIconHtml) && !$bIconImage;
-            
-        return $this->_oTemplate->parseHtmlByName('item_icon_preview.html', array(
-            'id' => $iId,
-            'bx_if:show_icon_empty' => array(
-                'condition' => !$bIconImage && !$bIconHtml,
-                'content' => array()
-            ),
-            'bx_if:show_icon_image' => array(
-                'condition' => $bIconImage,
-                'content' => array(
-                    'js_object' => $this->getJsObject(),
-                    'url' => $sIconImage,
-                    'id' => $iId
-                )
-            ),
-            'bx_if:show_icon_html' => array(
-                'condition' => $bIconHtml,
-                'content' => array(
-                    'icon' => $sIconHtml
-                )
-            )
-        ));
-    }
-
     protected function _getFormObject($sAction, $aLevel = array())
     {
     	bx_import('BxTemplStudioFormView');