Skip to content

Commit

Permalink
Implement call to hook filterHtmlContent on modules HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
elburgl69 committed Jan 7, 2021
1 parent 9dcc4d2 commit 18ce6a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ps_customtext.php
Expand Up @@ -27,10 +27,10 @@
exit;
}

use PrestaShop\PrestaShop\Adapter\ObjectPresenter;
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;

require_once _PS_MODULE_DIR_ . 'ps_customtext/classes/CustomText.php';

class Ps_Customtext extends Module implements WidgetInterface
{
// Equivalent module on PrestaShop 1.6, sharing the same data
Expand Down Expand Up @@ -279,12 +279,14 @@ public function renderWidget($hookName = null, array $configuration = [])

public function getWidgetVariables($hookName = null, array $configuration = [])
{
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'info_lang`
WHERE `id_lang` = ' . (int) $this->context->language->id . ' AND `id_shop` = ' . (int) $this->context->shop->id;

return [
'cms_infos' => Db::getInstance()->getRow($sql),
];
$customText = new CustomText(1, (int) $this->context->language->id, (int) $this->context->shop->id);
$objectPresenter = new ObjectPresenter();
$data = $objectPresenter->present($customText);
$data['id_lang'] = $this->context->language->id;
$data['id_shop'] = $this->context->shop->id;
unset($data['id']);

return ['cms_infos' => $data];
}

public function installFixtures()
Expand Down
1 change: 1 addition & 0 deletions tests/phpstan/phpstan.neon
Expand Up @@ -10,6 +10,7 @@ parameters:
ignoreErrors:
- '#If condition is always true.#'
- '#Property CustomText::$text \(string\) does not accept array<int|string, string>.#'
- "#Cannot unset offset 'id' on array\\('id_lang' => mixed, 'id_shop' => int\\).#"
## On 1.7.1.0
- '#Call to method assign\(\) on an unknown class Smarty_Data#'
reportUnmatchedIgnoredErrors: false
Expand Down

0 comments on commit 18ce6a1

Please sign in to comment.