// small clean

This commit is contained in:
Rémi Gaillard committed 2013-11-13 11:58:11 +01:00
1 parent 4a9383bbcf
commit 24a4694000
1 file changed
+10 -22
+10 -22
View File
@@ -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,8 +63,8 @@ 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();
@@ -72,23 +72,14 @@ public function install()
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(
@@ -137,7 +128,4 @@ public function install()
'blockfacebook_url' => Tools::getValue('blockfacebook_url', Configuration::get('blockfacebook_url')), 'blockfacebook_url' => Tools::getValue('blockfacebook_url', Configuration::get('blockfacebook_url')),
); );
} }
} }