Skip to content

Commit

Permalink
Use constant instead of static property
Browse files Browse the repository at this point in the history
  • Loading branch information
getdatakick committed Dec 19, 2022
1 parent 2bb7a30 commit 94640ac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions blockcontactinfos.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Blockcontactinfos extends Module
/**
* @var string[]
*/
protected static $contact_fields = [
const CONTACT_FIELDS = [
'BLOCKCONTACTINFOS_COMPANY',
'BLOCKCONTACTINFOS_ADDRESS',
'BLOCKCONTACTINFOS_PHONE',
Expand Down Expand Up @@ -83,7 +83,7 @@ public function install()
*/
public function uninstall()
{
foreach (Blockcontactinfos::$contact_fields as $field) {
foreach (static::CONTACT_FIELDS as $field) {
Configuration::deleteByName($field);
}
return (parent::uninstall());
Expand All @@ -98,7 +98,7 @@ public function getContent()
{
$html = '';
if (Tools::isSubmit('submitModule')) {
foreach (Blockcontactinfos::$contact_fields as $field) {
foreach (static::CONTACT_FIELDS as $field) {
Configuration::updateValue($field, Tools::getValue($field), true);
}
$this->_clearCache('blockcontactinfos.tpl');
Expand All @@ -124,7 +124,7 @@ public function hookHeader()
public function hookFooter($params)
{
if (!$this->isCached('blockcontactinfos.tpl', $this->getCacheId())) {
foreach (Blockcontactinfos::$contact_fields as $field) {
foreach (static::CONTACT_FIELDS as $field) {
$this->smarty->assign(strtolower($field), Configuration::get($field));
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ public function renderForm()
'languages' => $controller->getLanguages(),
'id_language' => $this->context->language->id
];
foreach (Blockcontactinfos::$contact_fields as $field) {
foreach (static::CONTACT_FIELDS as $field) {
$helper->tpl_vars['fields_value'][$field] = Tools::getValue($field, Configuration::get($field));
}
return $helper->generateForm([$fields_form]);
Expand Down

0 comments on commit 94640ac

Please sign in to comment.