// small clean
This commit is contained in:
1 parent
4a9383bbcf
commit
24a4694000
1 file changed
+11
-23
@@ -27,7 +27,7 @@
|
|||||||
if (!defined('_PS_VERSION_'))
|
if (!defined('_PS_VERSION_'))
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
class Blockfacebook extends Module
|
class BlockFacebook extends Module
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -38,16 +38,16 @@ class Blockfacebook extends Module
|
|||||||
$this->bootstrap = true;
|
$this->bootstrap = true;
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->displayName = $this->l('Block Facebook');
|
$this->displayName = $this->l('Block Facebook');
|
||||||
$this->description = $this->l('Display block facebook on the home page');
|
$this->description = $this->l('Display a block for subscribe to your Facebook page');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function install()
|
public function install()
|
||||||
{
|
{
|
||||||
return parent::install()
|
return parent::install() &&
|
||||||
&& Configuration::updateValue('blockfacebook_url', 'prestashop')
|
Configuration::updateValue('blockfacebook_url', 'prestashop') &&
|
||||||
&& $this->registerHook('displayHome')
|
$this->registerHook('displayHome') &&
|
||||||
&& $this->registerHook('displayHeader');
|
$this->registerHook('displayHeader');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
@@ -63,32 +63,23 @@ public function install()
|
|||||||
if (Tools::isSubmit('submitModule'))
|
if (Tools::isSubmit('submitModule'))
|
||||||
{
|
{
|
||||||
Configuration::updateValue('blockfacebook_url', Tools::getValue('blockfacebook_url'));
|
Configuration::updateValue('blockfacebook_url', Tools::getValue('blockfacebook_url'));
|
||||||
$this->_clearCache('blockfacebook.tpl');
|
|
||||||
$html .= $this->displayConfirmation($this->l('Configuration updated'));
|
$html .= $this->displayConfirmation($this->l('Configuration updated'));
|
||||||
|
$this->_clearCache('blockfacebook.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= $this->renderForm();
|
$html .= $this->renderForm();
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hookDisplayHeader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hookDisplayHome()
|
public function hookDisplayHome()
|
||||||
{
|
{
|
||||||
global $smarty;
|
|
||||||
if (!$this->isCached('blockfacebook.tpl', $this->getCacheId()))
|
if (!$this->isCached('blockfacebook.tpl', $this->getCacheId()))
|
||||||
$smarty->assign(array(
|
$this->context->smarty->assign('facebookurl', Configuration::get('blockfacebook_url'));
|
||||||
'facebookurl' => Configuration::get('blockfacebook_url'),
|
|
||||||
));
|
|
||||||
return $this->display(__FILE__, 'blockfacebook.tpl', $this->getCacheId());
|
return $this->display(__FILE__, 'blockfacebook.tpl', $this->getCacheId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function renderForm()
|
public function renderForm()
|
||||||
{
|
{
|
||||||
$fields_form = array(
|
$fields_form = array(
|
||||||
@@ -130,14 +121,11 @@ public function install()
|
|||||||
|
|
||||||
return $helper->generateForm(array($fields_form));
|
return $helper->generateForm(array($fields_form));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigFieldsValues()
|
public function getConfigFieldsValues()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'blockfacebook_url' => Tools::getValue('blockfacebook_url', Configuration::get('blockfacebook_url')),
|
'blockfacebook_url' => Tools::getValue('blockfacebook_url', Configuration::get('blockfacebook_url')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user