Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement call to hook filterHtmlContent on modules HTML #53

Merged
merged 1 commit into from Feb 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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();
Progi1984 marked this conversation as resolved.
Show resolved Hide resolved
$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