diff --git a/modules/blockpaymentlogo/blockpaymentlogo.php b/modules/blockpaymentlogo/blockpaymentlogo.php
index f8d092bdb..fbe57e0c9 100644
--- a/modules/blockpaymentlogo/blockpaymentlogo.php
+++ b/modules/blockpaymentlogo/blockpaymentlogo.php
@@ -63,14 +63,12 @@ class BlockPaymentLogo extends Module
public function getContent()
{
- $html = '
-
'.$this->l('Payment logo.').'
- ';
+ $html = '';
if (Tools::isSubmit('submitConfiguration'))
- if (Validate::isUnsignedInt(Tools::getValue('id_cms')))
+ if (Validate::isUnsignedInt(Tools::getValue('PS_PAYMENT_LOGO_CMS_ID')))
{
- Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int)(Tools::getValue('id_cms')));
+ Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int)(Tools::getValue('PS_PAYMENT_LOGO_CMS_ID')));
$this->_clearCache('blockpaymentlogo.tpl');
$html .= $this->displayConfirmation($this->l('The settings have been updated.'));
}
@@ -80,23 +78,8 @@ class BlockPaymentLogo extends Module
if (!count($cmss))
$html .= $this->displayError($this->l('No CMS page is available.'));
else
- {
- $html .= '
-
- ';
- }
+ $html .= $this->renderForm();
+
return $html;
}
@@ -139,6 +122,60 @@ class BlockPaymentLogo extends Module
return;
$this->context->controller->addCSS(($this->_path).'blockpaymentlogo.css', 'all');
}
+
+ public function renderForm()
+ {
+ $fields_form = array(
+ 'form' => array(
+ 'legend' => array(
+ 'title' => $this->l('Settings'),
+ 'icon' => 'icon-cogs'
+ ),
+ 'input' => array(
+ array(
+ 'type' => 'select',
+ 'label' => $this->l('Page CMS for link:'),
+ 'name' => 'PS_PAYMENT_LOGO_CMS_ID',
+ 'required' => false,
+ 'default_value' => (int)$this->context->country->id,
+ 'options' => array(
+ 'query' => CMS::listCms($this->context->language->id),
+ 'id' => 'id_cms',
+ 'name' => 'meta_title'
+ )
+ ),
+ ),
+ 'submit' => array(
+ 'title' => $this->l('Save'),
+ 'class' => 'btn btn-primary')
+ ),
+ );
+
+ $helper = new HelperForm();
+ $helper->show_toolbar = false;
+ $helper->table = $this->table;
+ $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
+ $helper->default_form_language = $lang->id;
+ $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
+ $helper->identifier = $this->identifier;
+ $helper->submit_action = 'submitConfiguration';
+ $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
+ $helper->token = Tools::getAdminTokenLite('AdminModules');
+ $helper->tpl_vars = array(
+ 'fields_value' => $this->getConfigFieldsValues(),
+ 'languages' => $this->context->controller->getLanguages(),
+ 'id_language' => $this->context->language->id
+ );
+
+ return $helper->generateForm(array($fields_form));
+ }
+
+ public function getConfigFieldsValues()
+ {
+ return array(
+ 'PS_PAYMENT_LOGO_CMS_ID' => Tools::getValue('PS_PAYMENT_LOGO_CMS_ID', Configuration::get('PS_PAYMENT_LOGO_CMS_ID')),
+ );
+ }
}