// Refactoring of shop class with new context Part 2

This commit is contained in:
rMalie
2011-07-13 12:52:09 +00:00
parent 375607f8a5
commit 8981b6aaee
21 changed files with 189 additions and 193 deletions
+56 -57
View File
@@ -38,62 +38,61 @@ if (!$cookie->isLoggedBack())
$destination = substr($_SERVER['REQUEST_URI'], strlen(dirname($_SERVER['SCRIPT_NAME'])) + 1);
Tools::redirectAdmin('login.php'.(empty($destination) || ($destination == 'index.php?logout') ? '' : '?redirect='.$destination));
}
else
$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
if ($back = Tools::getValue('back'))
$currentIndex .= '&back='.urlencode($back);
/* Server Params */
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$protocol_content = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$link = new Link($protocol_link, $protocol_content);
define('_PS_BASE_URL_', Tools::getShopDomain(true));
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
$employee = new Employee((int)$cookie->id_employee);
$cookie->id_lang = (int)$employee->id_lang;
$language = new Language($cookie->id_lang ? $cookie->id_lang : Configuration::get('PS_LANG_DEFAULT'));
$iso = $language->iso_code;
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
/* attribute id_lang is often needed, so we create a constant for performance reasons */
define('_USER_ID_LANG_', (int)$cookie->id_lang);
$path = dirname(__FILE__).'/themes/';
if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css'))
{
$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
if ($back = Tools::getValue('back'))
$currentIndex .= '&back='.urlencode($back);
/* Server Params */
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$protocol_content = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$link = new Link($protocol_link, $protocol_content);
define('_PS_BASE_URL_', Tools::getShopDomain(true));
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
$employee = new Employee((int)$cookie->id_employee);
$cookie->id_lang = (int)$employee->id_lang;
$language = new Language($cookie->id_lang ? $cookie->id_lang : Configuration::get('PS_LANG_DEFAULT'));
$iso = $language->iso_code;
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
/* attribute id_lang is often needed, so we create a constant for performance reasons */
define('_USER_ID_LANG_', (int)$cookie->id_lang);
$path = dirname(__FILE__).'/themes/';
if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css'))
{
if (file_exists($path.'oldschool/admin.css'))
$employee->bo_theme = 'oldschool';
elseif (file_exists($path.'origins/admin.css'))
$employee->bo_theme = 'origins';
else
foreach (scandir($path) as $theme)
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
{
$employee->bo_theme = $theme;
break;
}
$employee->update();
}
// Change shop context ?
if (Tools::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
{
$cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
$query = (isset($url['query'])) ? $url['query'] : '';
parse_str($query, $parseQuery);
unset($parseQuery['setShopContext']);
Tools::redirectAdmin($url['path'] . '?' . http_build_query($parseQuery));
}
$context = Context::getContext();
$context->employee = $employee;
$context->cookie = $cookie;
$context->link = $link;
$context->language = $language;
$context->country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'));
if (file_exists($path.'oldschool/admin.css'))
$employee->bo_theme = 'oldschool';
elseif (file_exists($path.'origins/admin.css'))
$employee->bo_theme = 'origins';
else
foreach (scandir($path) as $theme)
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
{
$employee->bo_theme = $theme;
break;
}
$employee->update();
}
// Change shop context ?
if (Tools::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
{
$cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
$query = (isset($url['query'])) ? $url['query'] : '';
parse_str($query, $parseQuery);
unset($parseQuery['setShopContext']);
Tools::redirectAdmin($url['path'] . '?' . http_build_query($parseQuery));
}
$context = Context::getContext();
$context->employee = $employee;
$context->cookie = $cookie;
$context->link = $link;
$context->language = $language;
$context->country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'));
$context->shop = new Shop(Shop::getContext('shop', true));
+1 -1
View File
@@ -133,7 +133,7 @@ class AdminMeta extends AdminTab
foreach ($this->_languages as $language)
echo '
<div id="url_rewrite_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
<input style="width:300px" type="text" name="url_rewrite_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($meta, 'url_rewrite', (int)($language['id_lang']), (int)$cookie->id_current_shop), ENT_COMPAT, 'UTF-8').'" />
<input style="width:300px" type="text" name="url_rewrite_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($meta, 'url_rewrite', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
<p class="clear" style="width:300px">'.$this->l('Example : "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php').'</p>
</div>';
+21 -26
View File
@@ -31,8 +31,6 @@ class AdminModulesPositions extends AdminTab
public function postProcess()
{
global $currentIndex;
// Getting key value for display
if (Tools::getValue('show_modules') AND strval(Tools::getValue('show_modules')) != 'all')
$this->displayKey = (int)(Tools::getValue('show_modules'));
@@ -48,7 +46,7 @@ class AdminModulesPositions extends AdminTab
if (Validate::isLoadedObject($module))
{
$module->updatePosition($id_hook, (int)(Tools::getValue('direction')));
Tools::redirectAdmin($currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
else
$this->_errors[] = Tools::displayError('module cannot be loaded');
@@ -89,7 +87,7 @@ class AdminModulesPositions extends AdminTab
elseif (!$module->registerExceptions($id_hook, $excepts, Shop::getListFromContext()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
Tools::redirectAdmin($currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
else
@@ -131,7 +129,7 @@ class AdminModulesPositions extends AdminTab
}
if (!$this->_errors)
Tools::redirectAdmin($currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
else
{
@@ -146,7 +144,7 @@ class AdminModulesPositions extends AdminTab
if (!$module->editExceptions($id_hook, $exceptions, Shop::getListFromContext()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
Tools::redirectAdmin($currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
}
@@ -172,7 +170,7 @@ class AdminModulesPositions extends AdminTab
if (!$module->unregisterHook($id_hook, Shop::getListFromContext()) OR !$module->unregisterExceptions($id_hook, Shop::getListFromContext()))
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
else
Tools::redirectAdmin($currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
else
@@ -202,7 +200,7 @@ class AdminModulesPositions extends AdminTab
}
}
if (!sizeof($this->_errors))
Tools::redirectAdmin($currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
}
@@ -217,9 +215,7 @@ class AdminModulesPositions extends AdminTab
public function displayList()
{
global $currentIndex;
$link = new Link();
$context = Context::getContext();
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
@@ -231,13 +227,13 @@ class AdminModulesPositions extends AdminTab
</script>
<script type="text/javascript" src="../js/admin-dnd.js"></script>
';
echo '<a href="'.$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> <b>'.$this->l('Transplant a module').'</b></a><br /><br />';
echo '<a href="'.$this->currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> <b>'.$this->l('Transplant a module').'</b></a><br /><br />';
// Print select list
echo '
<form>
'.$this->l('Show').' :
<select id="show_modules" onChange="autoUrl(\'show_modules\', \''.$currentIndex.'&token='.$this->token.'&show_modules=\')">
<select id="show_modules" onChange="autoUrl(\'show_modules\', \''.$this->currentIndex.'&token='.$this->token.'&show_modules=\')">
<option value="all">'.$this->l('All modules').'&nbsp;</option>
<option>---------------</option>';
$modules = Module::getModulesInstalled();
@@ -253,26 +249,26 @@ class AdminModulesPositions extends AdminTab
echo '
</select>
<br /><br />
<input type="checkbox" id="hook_position" onclick="autoUrlNoList(\'hook_position\', \''.$currentIndex.'&token='.$this->token.'&show_modules='.(int)(Tools::getValue('show_modules')).'&hook_position=\')" '.(Tools::getValue('hook_position') ? 'checked="checked" ' : '').' />&nbsp;<label class="t" for="hook_position">'.$this->l('Display non-positionable hook').'</label>
<input type="checkbox" id="hook_position" onclick="autoUrlNoList(\'hook_position\', \''.$this->currentIndex.'&token='.$this->token.'&show_modules='.(int)(Tools::getValue('show_modules')).'&hook_position=\')" '.(Tools::getValue('hook_position') ? 'checked="checked" ' : '').' />&nbsp;<label class="t" for="hook_position">'.$this->l('Display non-positionable hook').'</label>
</form>
<fieldset style="width:250px;float:right"><legend>'.$this->l('Live edit').'</legend>';
if (Tools::isMultiShopActivated() && Shop::getContextType() != Shop::CONTEXT_SHOP)
if (Tools::isMultiShopActivated() && $context->shop->getContextType() != Shop::CONTEXT_SHOP)
echo '<p>'.$this->l('You have to select a shop to use live edit').'</p>';
else
echo '<p>'.$this->l('By clicking here you will be redirected to the front office of your shop to move and delete modules directly.').'</p>
<br>
<a href="'.$link->getPageLink('index').'&live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).((Tools::isMultiShopActivated()) ? '&id_shop='.Context::getContext()->shop->getID() : '').'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
<a href="'.$context->link->getPageLink('index').'&live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).((Tools::isMultiShopActivated()) ? '&id_shop='.Context::getContext()->shop->getID() : '').'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
echo '</fieldset>';
// Print hook list
echo '<form method="post" action="'.$currentIndex.'&token='.$this->token.'">';
echo '<form method="post" action="'.$this->currentIndex.'&token='.$this->token.'">';
$irow = 0;
$hooks = Hook::getHooks(!(int)(Tools::getValue('hook_position')));
echo '<div id="unhook_button_position_top"><input class="button floatr" type="submit" name="unhookform" value="'.$this->l('Unhook the selection').'"/></div>';
$canMove = (Tools::isMultiShopActivated() && Shop::getContextType() != Shop::CONTEXT_SHOP) ? false : true;
$canMove = (Tools::isMultiShopActivated() && $context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
if (!$canMove)
echo '<br /><div><b>'.$this->l('If you want to order / move following data, please go in shop context (select a shop in shop list)').'</b></div>';
foreach ($hooks AS $hook)
@@ -307,8 +303,8 @@ class AdminModulesPositions extends AdminTab
echo '
<td class="positions" width="40">'.(int)($position).'</td>
<td'.(($canMove && $nbModules >= 2) ? ' class="dragHandle"' : '').' id="td_'.$hook['id_hook'].'_'.$instance->id.'" width="40">
'.(($canMove) ? '<a'.($position == 1 ? ' style="display: none;"' : '' ).' href="'.$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&direction=0&token='.$this->token.'&changePosition='.rand().'#'.$hook['name'].'"><img src="../img/admin/up.gif" alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a><br />
<a '.($position == count($instances) ? ' style="display: none;"' : '').'href="'.$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&direction=1&token='.$this->token.'&changePosition='.rand().'#'.$hook['name'].'"><img src="../img/admin/down.gif" alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>' : '').'
'.(($canMove) ? '<a'.($position == 1 ? ' style="display: none;"' : '' ).' href="'.$this->currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&direction=0&token='.$this->token.'&changePosition='.rand().'#'.$hook['name'].'"><img src="../img/admin/up.gif" alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a><br />
<a '.($position == count($instances) ? ' style="display: none;"' : '').'href="'.$this->currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&direction=1&token='.$this->token.'&changePosition='.rand().'#'.$hook['name'].'"><img src="../img/admin/down.gif" alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>' : '').'
</td>
<td style="padding-left: 10px;"><label class="lab_modules_positions" for="mod'.$hook['id_hook'].'_'.$instance->id.'">
';
@@ -321,8 +317,8 @@ class AdminModulesPositions extends AdminTab
</label></td>
<td width="60">';
echo '
<a href="'.$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&editGraft'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
<a href="'.$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&deleteGraft'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
<a href="'.$this->currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&editGraft'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
<a href="'.$this->currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&deleteGraft'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
<input type="checkbox" id="mod'.$hook['id_hook'].'_'.$instance->id.'" class="hook'.$hook['id_hook'].'" onclick="hookCheckboxes('.$hook['id_hook'].', 1, this)" name="unhooks[]" value="'.$hook['id_hook'].'_'.$instance->id.'"/>';
echo '
</td>
@@ -337,7 +333,6 @@ class AdminModulesPositions extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
$id_module = (int)(Tools::getValue('id_module'));
@@ -346,7 +341,7 @@ class AdminModulesPositions extends AdminTab
{
// Check auth for this page
if (!$id_module || !$id_hook)
Tools::redirectAdmin($currentIndex . '&token='.$this->token);
Tools::redirectAdmin($this->currentIndex . '&token='.$this->token);
$sql = 'SELECT id_module
FROM '._DB_PREFIX_.'hook_module
@@ -354,7 +349,7 @@ class AdminModulesPositions extends AdminTab
AND id_hook = '.$id_hook.'
AND id_shop IN('.implode(', ', ShopCore::getListFromContext()).')';
if (!Db::getInstance()->getValue($sql))
Tools::redirectAdmin($currentIndex . '&token='.$this->token);
Tools::redirectAdmin($this->currentIndex . '&token='.$this->token);
$slModule = Module::getInstanceById($id_module);
$exceptsList = $slModule->getExceptions($id_hook, true);
@@ -386,7 +381,7 @@ class AdminModulesPositions extends AdminTab
$modules = $instances;
$hooks = Hook::getHooks(0);
echo '
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">';
<form action="'.$this->currentIndex.'&token='.$this->token.'" method="post">';
if ($this->displayKey)
echo '<input type="hidden" name="show_modules" value="'.$this->displayKey.'" />';
echo '<fieldset style="width:700px"><legend><img src="../img/t/AdminModulesPositions.gif" />'.$this->l('Transplant a module').'</legend>
+9 -17
View File
@@ -29,14 +29,13 @@ class AdminPreferences extends AdminTab
{
public function __construct()
{
global $cookie;
$context = Context::getContext();
$this->className = 'Configuration';
$this->table = 'configuration';
$timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM '._DB_PREFIX_.'timezone');
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
foreach (Tax::getTaxes((int)($cookie->id_lang)) as $tax)
foreach (Tax::getTaxes($context->language->id) as $tax)
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
$order_process_type = array(
@@ -71,7 +70,7 @@ class AdminPreferences extends AdminTab
'name' => $this->l('None')
)
);
foreach (CMS::listCms($cookie->id_lang) as $cms_file)
foreach (CMS::listCms($context->language->id) as $cms_file)
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
$this->_fieldsGeneral = array(
@@ -117,8 +116,6 @@ class AdminPreferences extends AdminTab
public function postProcess()
{
global $currentIndex;
if (isset($_POST['submitGeneral'.$this->table]))
{
Module::hookExec('categoryUpdate'); // We call this hook, for regenerate cache of categories
@@ -152,7 +149,7 @@ class AdminPreferences extends AdminTab
if ($val = Tools::getValue('PS_THEME'))
{
if (rewriteSettingsFile(NULL, $val, NULL))
Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=6'.'&token='.$this->token);
else
$this->_errors[] = Tools::displayError('Cannot access settings file.');
}
@@ -169,12 +166,10 @@ class AdminPreferences extends AdminTab
* Update settings in database and configuration files
*
* @params array $fields Fields settings
*
* @global string $currentIndex Current URL in order to keep current Tab
*/
protected function _postConfig($fields)
{
global $currentIndex, $smarty;
global $smarty;
$languages = Language::getLanguages(false);
if (!Configuration::get('PS_FORCE_SMARTY_2'))
@@ -282,7 +277,7 @@ class AdminPreferences extends AdminTab
if (!sizeof($this->_errors))
{
$this->submitConfiguration($fields);
Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token);
Tools::redirectAdmin($this->currentIndex.'&conf=6'.'&token='.$this->token);
}
}
}
@@ -330,13 +325,10 @@ class AdminPreferences extends AdminTab
*
* @params string $name Form name
* @params array $fields Fields settings
*
* @global string $currentIndex Current URL in order to keep current Tab
*/
protected function _displayForm($name, $fields, $tabname, $size, $icon)
{
global $currentIndex;
$context = Context::getContext();
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages(false);
$confValues = $this->getConf($fields, $languages);
@@ -355,7 +347,7 @@ class AdminPreferences extends AdminTab
$(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\',\''.Tools::getRemoteAddr().'\');
}
</script>
<form action="'.$currentIndex.'&submit'.$name.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
<form action="'.$this->currentIndex.'&submit'.$name.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="../img/admin/'.strval($icon).'.gif" />'.$tabname.'</legend>';
foreach ($fields AS $key => $field)
{
@@ -376,7 +368,7 @@ class AdminPreferences extends AdminTab
echo '<div class="margin-form" style="padding-top:5px;">';
}
$isDisabled = (isset($field['visibility']) && $field['visibility'] > Shop::getContextType()) ? true : false;
$isDisabled = (isset($field['visibility']) && $field['visibility'] > $context->shop->getContextType()) ? true : false;
/* Display the appropriate input type for each field */
switch ($field['type'])