Jelajahi Sumber

Ticket #5689 - Grids: Add possibility to use [Load More] instead of default pagination.

AntonLV 3 minggu lalu
induk
melakukan
4379c36b67

+ 24 - 143
inc/classes/BxDolPaginate.php

@@ -62,10 +62,6 @@ define('BX_DOL_PAGINATE_PER_PAGE_DEFAULT', 10);
  */
 abstract class BxDolPaginate extends BxDol
 {
-    protected static $_isCssAdded = false;
-
-    protected $_oTemplate;
-
     protected $_aParams; ///< an array with initially provided params
 
     protected $_iStart; ///< start display items from this number
@@ -82,21 +78,13 @@ abstract class BxDolPaginate extends BxDol
     protected $_sViewAllUrl; ///< view "all results" url, for "simple" paginate
     protected $_sViewAllCaption; ///< 'view all' link caption
 
-    protected $_sButtonsClass; ///< add this class to buttons class attribute
-    protected $_sPaginateClass; ///< add this class to whole paginate container div
-
     /**
      * Constructor
      */
-    public function __construct($aParams, $oTemplate = null)
+    public function __construct($aParams)
     {
         parent::__construct();
 
-        if ($oTemplate)
-            $this->_oTemplate = $oTemplate;
-        else
-            $this->_oTemplate = BxDolTemplate::getInstance();
-
         if (isset($aParams['count']))
            trigger_error ('Paginate "count" is deprecated - use "num" instead: ' . get_class($this), E_USER_ERROR);
 
@@ -111,11 +99,9 @@ abstract class BxDolPaginate extends BxDol
         $this->_bTotal = $this->_iTotal > 0;
 
         $this->_bInfo = isset($aParams['info']) ? (bool)$aParams['info'] : true;
-        $this->_sButtonsClass = isset($aParams['buttons_class']) ? $aParams['buttons_class'] : '';
+        
         $this->_sViewAllUrl = isset($aParams['view_all_url']) ? $aParams['view_all_url'] : false;
-        $this->_sViewAllCaption = isset($aParams['view_all_caption']) ? $aParams['view_all_caption'] : _t('_sys_paginate_view_all');
-
-        $this->_sPaginateClass = isset($aParams['paginate_class']) ? $aParams['paginate_class'] : '';
+        $this->_sViewAllCaption = isset($aParams['view_all_caption']) ? $aParams['view_all_caption'] : _t('_sys_paginate_view_all');       
 
         // page url
         $this->_sPageUrl = isset($aParams['page_url']) ? $aParams['page_url'] : BX_DOL_URL_ROOT;
@@ -242,151 +228,46 @@ abstract class BxDolPaginate extends BxDol
         return $this->_iNum > $this->_iPerPage ? true : false;
     }
 
-    /**
-     * Get default paginate, it is better to use it on the whole page.
-     * @param $iStart - @see setStart.
-     * @param $iNum - @see setNum and @see setNumFromDataArray.
-     * @param $iPerPage - @see setPerPage.
-     * @return HTML string.
-     */
-    public function getPaginate($iStart = -1, $iNum = -1, $iPerPage = -1)
+    public function isLoadMoreAvail ()
     {
-        $this->setNum($iNum);
-        if (!$this->_iNum)
-            return '';
-
-        $this->setStart($iStart);
-        $this->setPerPage($iPerPage);
-
-        if (0 == $this->getStart() && !$this->isNextAvail ())
-            return '';
-
-        $aReplacement = $this->_getReplacement();
-
-        //--- Previous Page button ---//
-        $sPrevLnkUrl = 'javascript:void(0);';
-        $sPrevLnkClick = '';
-        $sPrevClassAdd = ' bx-btn-disabled';
-        if ($this->isPrevAvail()) {
-            $iStartPrev = $this->_iStart - $this->_iPerPage > 0 ? $this->_iStart - $this->_iPerPage : 0;
-            $aReplacementLink = array_merge($aReplacement, array('start' => $iStartPrev));
-            $sPrevLnkUrl = $this->_getPageChangeUrl($aReplacementLink);
-            $sPrevLnkClick = $this->_getPageChangeOnClick($aReplacementLink);
-            $sPrevClassAdd = '';
-        }
-
-        //--- Next Page button ---//
-        $sNextLnkUrl = 'javascript:void(0);';
-        $sNextLnkClick = '';
-        $sNextClassAdd = ' bx-btn-disabled';
-        if ($this->isNextAvail()) {
-            $aReplacementLink = array_merge($aReplacement, array('start' => $this->_iStart + $this->_iPerPage));
-            $sNextLnkUrl = $this->_getPageChangeUrl($aReplacementLink);
-            $sNextLnkClick = $this->_getPageChangeOnClick($aReplacementLink);
-            $sNextClassAdd = '';
-        }
-
-        $sClassAdd = ($this->_sButtonsClass ? ' ' . $this->_sButtonsClass : '');
-
-        $aVariables = [
-            'bx_if:info' => [
-                'condition' => $this->_bInfo && !$this->_bTotal,
-                'content' => [
-                    'text' => _t('_sys_paginate_info', $this->_iStart + 1, $this->_iStart + ($this->isNextAvail () ? $this->_iPerPage : $this->_iNum)),
-                ],
-            ],
-            'bx_if:total' => [
-                'condition' => $this->_bTotal,
-                'content' => [
-                    'text' => _t('_sys_paginate_total', $this->_iStart + 1, $this->_iStart + ($this->isNextAvail() ? $this->_iPerPage : $this->_iNum), $this->_iTotal),
-                ],
-            ],
-            'bx_if:view_all' => [
-                'condition' => (bool)$this->_sViewAllUrl,
-                'content' => [
-                    'lnk_url' => $this->_sViewAllUrl,
-                    'lnk_title' => $this->_sViewAllCaption,
-                    'lnk_content' => $this->_sViewAllCaption,
-                ],
-            ],
-            'btn_prev' => $this->_getButton('prev', [
-                'class' => $sClassAdd . $sPrevClassAdd,
-                'href' => $sPrevLnkUrl,
-                'onclick' => $sPrevLnkClick,
-            ]),
-            'btn_next' => $this->_getButton('next', [
-                'class' => $sClassAdd . $sNextClassAdd,
-                'href' => $sNextLnkUrl,
-                'onclick' => $sNextLnkClick,
-            ]),
-            'paginate_class' => $this->_sPaginateClass,
-            'bx_repeat:attrs' => [
-                ['key' => 'bx-data-start', 'value' => $this->_iStart],
-                ['key' => 'bx-data-perpage', 'value' => $this->_iPerPage]
-            ]
-        ];
-
-        $this->addCssJs();
-        return $this->_oTemplate->parseHtmlByName('paginate.html', $aVariables);
-    }
-
-    /**
-     * Get limited paginate, it is better to use in some boxes, where availabel space is limited or for ajax paginate.
-     * @param $sViewAllUrl - url to page for 'view all' link.
-     * @param $iStart - @see setStart.
-     * @param $iNum - @see setNum and @see setNumFromDataArray.
-     * @param $iPerPage - @see setPerPage.
-     * @return HTML string.
-     */
-    public function getSimplePaginate($sViewAllUrl = '', $iStart = -1, $iNum = -1, $iPerPage = -1)
-    {
-        if($sViewAllUrl)
-            $this->_sViewAllUrl = $sViewAllUrl;
-
-        if(!isset($this->_aParams['info']))
-            $this->_bInfo = false;
-
-        $this->_sButtonsClass .= ($this->_sButtonsClass ? ' ' : '') . 'bx-btn-small bx-btn-symbol-small';
-        $this->_sPaginateClass = 'bx-paginate-simple';
-
-        return $this->getPaginate($iStart, $iNum, $iPerPage);
-    }
-
-    public function addCssJs ()
-    {
-        if (self::$_isCssAdded)
-            return false;
-        $this->_oTemplate->addCss('paginate.css');
-        self::$_isCssAdded = true;
-        return true;
+        return $this->isNextAvail();
     }
 
     protected function _getReplacement()
     {
-        return array(
+        return [
             'start' => $this->_iStart,
             'per_page' => $this->_iPerPage,
-        );
+        ];
+    }
+
+    protected function _getReplacementPrev()
+    {
+        return array_merge($this->_getReplacement(), [
+            'start' => ($iStart = $this->_iStart - $this->_iPerPage) > 0 ? $iStart : 0
+        ]);
     }
 
-    protected function _getPageChangeUrl($aReplacement)
+    protected function _getReplacementNext()
     {
-        return $this->_oTemplate->parseHtmlByContent($this->_sPageUrl, $aReplacement, array('{', '}'));
+        return array_merge($this->_getReplacement(), [
+            'start' => $this->_iStart + $this->_iPerPage
+        ]);
     }
 
-    protected function _getPageChangeOnClick($aReplacement)
+    protected function _getReplacementLoadMore()
     {
-        return !empty($this->_sOnChangePage) ? 'onclick="javascript:' . $this->_oTemplate->parseHtmlByContent($this->_sOnChangePage, $aReplacement, array('{', '}')) . '; return false;"' : '';
+        return $this->_getReplacementNext();
     }
 
-    protected function _getButtonIconPrev()
+    protected function _getPageChangeUrl($aMarkers)
     {
-        return 'angle-double-left';
+        return bx_replace_markers($this->_sPageUrl, $aMarkers);
     }
 
-    protected function _getButtonIconNext()
+    protected function _getPageChangeOnClick($aMarkers)
     {
-        return 'angle-double-right';
+        return !empty($this->_sOnChangePage) ? 'onclick="javascript:' . bx_replace_markers($this->_sOnChangePage, $aMarkers) . '; return false;"' : '';
     }
 }
 

+ 20 - 3
inc/js/classes/BxDolGrid.js

@@ -272,10 +272,22 @@ BxDolGrid.prototype.processJson = function (oData, sAction, isDisableLoading) {
             if (typeof($this.onReload) == 'function') {
                 $this.onReload(oData);
             } else {
-                $('#' + $this._sIdContainer).html($(oData.grid).find('#' + $this._sIdContainer).html());
-                var sFooter = $(oData.grid).find('.bx-grid-footer').size() ? $(oData.grid).find('.bx-grid-footer').html() : '';
-                $('#' + $this._sIdWrapper).find('.bx-grid-footer').html(sFooter);
                 $('#' + $this._sIdWrapper).find('.bx-grid-header-controls-counter-value').html(oData.total_count_f);
+
+                switch(sAction) {
+                    case 'display':
+                        $('#' + $this._sIdContainer).html($(oData.grid).find('#' + $this._sIdContainer).html());
+                        break;
+
+                    case 'load_more':
+                        var sClassData = 'bx-grid-table-data';
+                        $('#' + $this._sIdContainer).find('.' + sClassData).append($(oData.grid).find('#' + $this._sIdContainer + ' .' + sClassData).html());
+                        break;
+                }
+
+                var oFooter = $(oData.grid).find('.bx-grid-footer');
+                $('#' + $this._sIdWrapper).find('.bx-grid-footer').html(oFooter.size() ? oFooter.html() : '');
+
                 $this._onDataReloaded(true);
             }
         }
@@ -355,6 +367,11 @@ BxDolGrid.prototype.reload = function (iStart, iPerPage) {
     this.action('display', oData);
 };
 
+BxDolGrid.prototype.loadMore = function (iStart, iPerPage) {
+    var oData = this._getActionDataForReload(iStart, iPerPage);
+    this.action('load_more', oData);
+};
+
 BxDolGrid.prototype._getActionDataForReload = function (iStart, iPerPage) {
     var oData = {};
 

+ 0 - 21
studio/template/paginate.html

@@ -1,21 +0,0 @@
-<div class="bx-paginate __paginate_class__ flex items-center" <bx_repeat:attrs>__key__="__value__" </bx_repeat:attrs>>
-    <div class="bx-paginate-btns bx-btn-group">
-        __btn_prev__
-        __btn_next__
-    </div>
-    <bx_if:info>
-        <div class="bx-paginate-info pl-4">
-            __text__
-        </div>
-    </bx_if:info>
-    <bx_if:total>
-        <div class="bx-paginate-info bx-pi-total pl-4">
-            __text__
-        </div>
-    </bx_if:total>
-    <bx_if:view_all>
-        <div class="bx-paginate-view-all pl-4">
-            <a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a>
-        </div>
-    </bx_if:view_all>
-</div>

+ 0 - 1
studio/template/paginate_btn.html

@@ -1 +0,0 @@
-<a class="bx-btn __class__" href="__href__" __onclick__><svg class="bx-paginate-glyph bx-paginate-glyph-prev" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m11 17-5-5 5-5"/><path d="m18 17-5-5 5-5"/></svg><svg class="bx-paginate-glyph bx-paginate-glyph-next" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 17 5-5-5-5"/><path d="m13 17 5-5-5-5"/></svg></a>

+ 1 - 1
template/grid.html

@@ -32,7 +32,7 @@
                         </tr>
                     </thead>
                 </bx_if:display_head>
-                <tbody>
+                <tbody class="bx-grid-table-data">
                         <bx_repeat:rows_data>
                             <tr id="__id_row__" class="__row_class__">
                                 __row__

+ 3 - 3
template/paginate.html

@@ -1,7 +1,7 @@
 <div class="bx-paginate __paginate_class__ flex items-center" <bx_repeat:attrs>__key__="__value__" </bx_repeat:attrs>>
-    <div class="bx-paginate-btns bx-btn-group flex space-x-4">
-        __btn_prev__
-        __btn_next__
+    <div class="bx-paginate-btns bx-btn-group">
+        __btn_1__
+        __btn_2__
     </div>
     <bx_if:info>
         <div class="bx-paginate-info pl-4">

+ 4 - 1
template/paginate_btn.html

@@ -1 +1,4 @@
-<a class="bx-btn __class__" href="__href__" __onclick__><i class="sys-icon sys-icon-bigger __icon__"></i></a>
+<a class="bx-btn __class__" href="__href__" __onclick__>
+    <bx_if:icon><i class="sys-icon sys-icon-bigger __icon__"></i></bx_if:icon>
+    <bx_if:title>__title__</bx_if:title>
+</a>

+ 13 - 6
template/scripts/BxBaseGrid.php

@@ -16,6 +16,7 @@ class BxBaseGrid extends BxDolGrid
     protected $_oTemplate;
     protected $_oFunctions;
     protected $_aPopupOptions = false;
+    protected $_sPaginateType; // default (empty value), simple, load_more
     protected $_aQueryAppend = [];
     protected $_aQueryAppendExclude = false; // an array of keys which shouldn't be pathed in http requests, but can be stored (used) in 'Query Append' array.
     protected $_aQueryAppendExcludeApi = false;
@@ -37,6 +38,7 @@ class BxBaseGrid extends BxDolGrid
         $this->_oFunctions = BxTemplFunctions::getInstanceWithTemplate($this->_oTemplate);
 
         $this->_aPopupOptions = [];
+        $this->_sPaginateType = '';
 
         $this->_aQueryAppend = [
             $this->_oTemplate->getCodeKey() => $this->_oTemplate->getCode()
@@ -62,11 +64,16 @@ class BxBaseGrid extends BxDolGrid
 
         require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
 
-        echoJson(array(
+        echoJson([
             'grid' => $this->getCode(false), 
             'total_count' => $this->_iTotalCount,
             'total_count_f' => $this->_getCounter()
-        ));
+        ]);
+    }
+
+    public function performActionLoadMore()
+    {
+        $this->performActionDisplay();
     }
 
     public function performActionReorder()
@@ -208,11 +215,11 @@ class BxBaseGrid extends BxDolGrid
                     $sPageUrl = bx_append_url_params($sPageUrl, $aParamsAppend);
             }
 
-            $aPaginateParams = array(
+            $aPaginateParams = [
                 'start' => $iStart,
                 'per_page' => $iPerPage,
-                'page_url' =>  $sPageUrl ? $sPageUrl : "javascript:glGrids." . $this->_sObject . ".reload('{start}'); void(0);",
-            );
+                'page_url' =>  $sPageUrl ? $sPageUrl : "javascript:glGrids." . $this->_sObject . "." . ($this->_sPaginateType == 'load_more' ? 'loadMore' : 'reload') . "('{start}'); void(0);",
+            ];
 
             $oPaginate = new BxTemplPaginate($aPaginateParams, $this->_oTemplate);
             $oPaginate->setNumFromDataArray($aData);
@@ -220,7 +227,7 @@ class BxBaseGrid extends BxDolGrid
             if (isset($this->_aOptions['paginate_simple']) && false !== $this->_aOptions['paginate_simple'])
                 $sPaginate = $oPaginate->getSimplePaginate($this->_aOptions['paginate_simple']);
             else
-                $sPaginate = $oPaginate->getPaginate();
+                $sPaginate = $oPaginate->{'get' . bx_gen_method_name($this->_sPaginateType) . 'Paginate'}();
         } else {
             $aData = $this->_getData ($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
         }

+ 191 - 5
template/scripts/BxBasePaginate.php

@@ -12,19 +12,205 @@
  */
 class BxBasePaginate extends BxDolPaginate
 {
-    function __construct($aParams, $oTemplate)
+    protected static $_isCssAdded = false;
+
+    protected $_oTemplate;
+
+    protected $_sPaginateClass; ///< add this class to whole paginate container div
+    protected $_sButtonsClass; ///< add this class to buttons class attribute
+    protected $_aButtonsConf; ///< buttons configuration
+
+    public function __construct($aParams, $oTemplate = null)
+    {
+        parent::__construct($aParams);
+
+        if ($oTemplate)
+            $this->_oTemplate = $oTemplate;
+        else
+            $this->_oTemplate = BxDolTemplate::getInstance();
+
+        $this->_sPaginateClass = $aParams['paginate_class'] ?? '';
+        $this->_sButtonsClass = $aParams['buttons_class'] ?? '';
+        $this->_aButtonsConf = [
+            'btn_1' => [
+                'name' => 'prev',
+                'active' => $aParams['button_prev'] ?? true
+            ], 
+            'btn_2' => [
+                'name' => 'next',
+                'active' => $aParams['button_next'] ?? true
+            ]
+        ];
+    }
+
+    /**
+     * Get default paginate, it is better to use it on the whole page.
+     * @param $iStart - @see setStart.
+     * @param $iNum - @see setNum and @see setNumFromDataArray.
+     * @param $iPerPage - @see setPerPage.
+     * @return HTML string.
+     */
+    public function getPaginate($iStart = -1, $iNum = -1, $iPerPage = -1)
+    {
+        $this->setNum($iNum);
+        if (!$this->_iNum)
+            return '';
+
+        $this->setStart($iStart);
+        $this->setPerPage($iPerPage);
+
+        if (0 == $this->getStart() && !$this->isNextAvail ())
+            return '';
+
+        $sClassAdd = ($this->_sButtonsClass ? ' ' . $this->_sButtonsClass : '');
+
+        $aTmplVarsButtons = [];
+        foreach($this->_aButtonsConf as $sTmplVar => $aConf) {
+            if(!$aConf['active'])
+                continue;
+
+            $sName = $aConf['name'];
+            $sClassAdd = ' bx-btn-disabled';
+            $sLinkUrl = 'javascript:void(0);';
+            $sLinkClick = '';
+            if(($sMethod = bx_gen_method_name($sName)) && $this->{'is' . $sMethod . 'Avail'}()) {
+                $aReplacementLink = $this->{'_getReplacement' . $sMethod}();
+
+                $sClassAdd = '';
+                $sLinkUrl = $this->_getPageChangeUrl($aReplacementLink);
+                $sLinkClick = $this->_getPageChangeOnClick($aReplacementLink);
+            }
+
+            $aTmplVarsButtons[$sTmplVar] = $this->_getButton($sName, [
+                'class' => $sClassAdd . $sClassAdd,
+                'href' => $sLinkUrl,
+                'onclick' => $sLinkClick,
+            ]);
+        }
+
+        $this->addCssJs();
+        return $this->_oTemplate->parseHtmlByName('paginate.html', array_merge([
+            'bx_if:info' => [
+                'condition' => $this->_bInfo && !$this->_bTotal,
+                'content' => [
+                    'text' => _t('_sys_paginate_info', $this->_iStart + 1, $this->_iStart + ($this->isNextAvail () ? $this->_iPerPage : $this->_iNum)),
+                ],
+            ],
+            'bx_if:total' => [
+                'condition' => $this->_bTotal,
+                'content' => [
+                    'text' => _t('_sys_paginate_total', $this->_iStart + 1, $this->_iStart + ($this->isNextAvail() ? $this->_iPerPage : $this->_iNum), $this->_iTotal),
+                ],
+            ],
+            'bx_if:view_all' => [
+                'condition' => (bool)$this->_sViewAllUrl,
+                'content' => [
+                    'lnk_url' => $this->_sViewAllUrl,
+                    'lnk_title' => $this->_sViewAllCaption,
+                    'lnk_content' => $this->_sViewAllCaption,
+                ],
+            ],
+            'btn_1' => '',
+            'btn_2' => '',
+            'paginate_class' => $this->_sPaginateClass,
+            'bx_repeat:attrs' => [
+                ['key' => 'bx-data-start', 'value' => $this->_iStart],
+                ['key' => 'bx-data-perpage', 'value' => $this->_iPerPage]
+            ]
+        ], $aTmplVarsButtons));
+    }
+
+    /**
+     * Get limited paginate, it is better to use in some boxes, where availabel space is limited or for ajax paginate.
+     * @param $sViewAllUrl - url to page for 'view all' link.
+     * @param $iStart - @see setStart.
+     * @param $iNum - @see setNum and @see setNumFromDataArray.
+     * @param $iPerPage - @see setPerPage.
+     * @return HTML string.
+     */
+    public function getSimplePaginate($sViewAllUrl = '', $iStart = -1, $iNum = -1, $iPerPage = -1)
     {
-        parent::__construct($aParams, $oTemplate);
+        if($sViewAllUrl)
+            $this->_sViewAllUrl = $sViewAllUrl;
+
+        if(!isset($this->_aParams['info']))
+            $this->_bInfo = false;
+
+        $this->_sButtonsClass .= ($this->_sButtonsClass ? ' ' : '') . 'bx-btn-small bx-btn-symbol-small';
+        $this->_sPaginateClass = 'bx-paginate-simple';
+
+        return $this->getPaginate($iStart, $iNum, $iPerPage);
+    }
+
+    public function getLoadMorePaginate($sViewAllUrl = '', $iStart = -1, $iNum = -1, $iPerPage = -1)
+    {
+        if($sViewAllUrl)
+            $this->_sViewAllUrl = $sViewAllUrl;
+
+        if(!isset($this->_aParams['info']))
+            $this->_bInfo = false;
+
+        $this->_sPaginateClass = 'bx-paginate-simple-load-more';
+        $this->_sButtonsClass .= ($this->_sButtonsClass ? ' ' : '') . 'bx-btn-small bx-btn-symbol-small';
+        
+        $this->_aButtonsConf['btn_1']['active'] = false;
+        $this->_aButtonsConf['btn_2']['name'] = 'load_more';
+
+        return $this->getPaginate($iStart, $iNum, $iPerPage);
+    }
+
+    public function addCssJs ()
+    {
+        if(self::$_isCssAdded)
+            return false;
+
+        $this->_oTemplate->addCss('paginate.css');
+        self::$_isCssAdded = true;
+        return true;
     }
 
     protected function _getButton($sName, $aParams)
     {
-        return $this->_oTemplate->parseHtmlByName('paginate_btn.html', array(
+        $aTmplVarsIcon = [];
+        if(($sMethodIc = '_getButtonIcon' . bx_gen_method_name($sName)) && method_exists($this, $sMethodIc))
+            $aTmplVarsIcon = [
+                'icon' => $this->$sMethodIc()
+            ];
+
+        $aTmplVarsTitle = [];
+        if(($sMethodTtl = '_getButtonTitle' . bx_gen_method_name($sName)) && method_exists($this, $sMethodTtl))
+            $aTmplVarsTitle = [
+                'title' => $this->$sMethodTtl()
+            ];
+
+        return $this->_oTemplate->parseHtmlByName('paginate_btn.html', [
             'class' => 'bx-paginate-btn bx-paginate-btn-' . $sName . (!empty($aParams['class']) ? $aParams['class'] : ''),
             'href' => !empty($aParams['href']) ? $aParams['href'] : 'javascript:void(0)',
             'onclick' => !empty($aParams['onclick']) ? $aParams['onclick'] : '',
-            'icon' => $this->{'_getButtonIcon' . bx_gen_method_name($sName)}()
-        ));
+            'bx_if:icon' => [
+                'condition' => $aTmplVarsIcon && is_array($aTmplVarsIcon), 
+                'content' => $aTmplVarsIcon
+            ],
+            'bx_if:title' => [
+                'condition' => $aTmplVarsTitle && is_array($aTmplVarsTitle), 
+                'content' => $aTmplVarsTitle
+            ],
+        ]);
+    }
+
+    protected function _getButtonIconPrev()
+    {
+        return 'angle-double-left';
+    }
+
+    protected function _getButtonIconNext()
+    {
+        return 'angle-double-right';
+    }
+
+    protected function _getButtonTitleLoadMore()
+    {
+        return 'Load More...';
     }
 }