From f168dd7c5017c7347ec1ceedf49344206ad77dd1 Mon Sep 17 00:00:00 2001 From: Kevin Granger Date: Wed, 2 Oct 2013 17:38:53 +0200 Subject: [PATCH] // list icon backward compat --- .../template/helpers/list/list_content.tpl | 13 +++++++--- classes/controller/AdminController.php | 1 + classes/helper/Helper.php | 1 + classes/helper/HelperList.php | 26 ++++++++++++------- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/admin-dev/themes/default/template/helpers/list/list_content.tpl b/admin-dev/themes/default/template/helpers/list/list_content.tpl index a66243ae7..3ce69e1ec 100644 --- a/admin-dev/themes/default/template/helpers/list/list_content.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_content.tpl @@ -59,7 +59,7 @@ {block name="td_content"} {if isset($params.prefix)}{$params.prefix}{/if} {if isset($params.color) && isset($tr[$params.color])} - + {/if} {if isset($tr.$key)} {if isset($params.active)} @@ -87,7 +87,11 @@ {$tr.$key} {elseif isset($params.icon)} {if is_array($tr[$key])} - {$tr[$key]['alt']} + {if isset($tr[$key]['class'])} + + {else} + {$tr[$key]['alt']} + {/if} {/if} {elseif isset($params.price)} {$tr.$key} @@ -107,7 +111,7 @@ {elseif isset($params.callback)} {$tr.$key} {elseif $key == 'color'} -
+
{elseif isset($params.maxlength) && Tools::strlen($tr.$key) > $params.maxlength} {$tr.$key|truncate:$params.maxlength:'...'|escape:'htmlall':'UTF-8'} {else} @@ -132,7 +136,8 @@ {$tr.shop_short_name} {else} {$tr.shop_name} - {/if} + {/if} + {/if} {if $has_actions} diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 229a3c197..e9cb4cef9 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1846,6 +1846,7 @@ class AdminControllerCore extends Controller $helper->position_identifier = $this->position_identifier; $helper->controller_name = $this->controller_name; $helper->list_id = isset($this->list_id) ? $this->list_id : $this->table; + $helper->bootstrap = $this->bootstrap; // For each action, try to add the corresponding skip elements list $helper->list_skip_actions = $this->list_skip_actions; diff --git a/classes/helper/Helper.php b/classes/helper/Helper.php index 5d031f6ef..ccdc51d9c 100755 --- a/classes/helper/Helper.php +++ b/classes/helper/Helper.php @@ -36,6 +36,7 @@ class HelperCore public $show_toolbar = true; public $context; public $toolbar_scroll = false; + public $bootstrap = false; /** * @var Module diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 9248a75ea..cce1a5413 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -266,16 +266,24 @@ class HelperListCore extends Helper } elseif (isset($params['icon']) && isset($tr[$key]) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default']))) { - if (isset($params['icon'][$tr[$key]]) && is_array($params['icon'][$tr[$key]])) - $this->_list[$index][$key] = array( - 'src' => $params['icon'][$tr[$key]]['src'], - 'alt' => $params['icon'][$tr[$key]]['alt'], - ); + if (!$this->bootstrap) + { + if (isset($params['icon'][$tr[$key]]) && is_array($params['icon'][$tr[$key]])) + $this->_list[$index][$key] = array( + 'src' => $params['icon'][$tr[$key]]['src'], + 'alt' => $params['icon'][$tr[$key]]['alt'], + ); + else + $this->_list[$index][$key] = array( + 'src' => isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'], + 'alt' => isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'], + ); + } else - $this->_list[$index][$key] = array( - 'src' => isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'], - 'alt' => isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'], - ); + if (isset($params['icon'][$tr[$key]])) + $this->_list[$index][$key] = array( + 'class' => $params['icon'][$tr[$key]], + ); } elseif (isset($params['type']) && $params['type'] == 'float') $this->_list[$index][$key] = rtrim(rtrim($tr[$key], '0'), '.');