Skip to content

Commit

Permalink
Fix php8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lopes-vincent committed Sep 6, 2022
1 parent 894143f commit 8619436
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
2 changes: 2 additions & 0 deletions Config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<hooks>
<hook id="notrewritenurls.hook.back" class="RewriteUrl\Hook\ConfigurationHook" scope="request">
<tag name="hook.event_listener" event="configuration.catalog-top" type="back" method="onConfigurationCatalogTop"/>
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigurationJavascript" />
</hook>
</hooks>

Expand Down
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<descriptive locale="fr_FR">
<title>Gérer la réécriture d'url</title>
</descriptive>
<version>2.1.1</version>
<version>2.1.2</version>
<author>
<name>Vincent Lopes, Gilles Bourgeat, Tom Pradat</name>
<email>[email protected], [email protected], [email protected]</email>
Expand Down
3 changes: 0 additions & 3 deletions Config/routing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="rewrite.url.config" path="/admin/module/RewriteUrl">
<default key="_controller">RewriteUrl\Controller\Admin\ModuleConfigController::viewConfigAction</default>
</route>
<route id="rewrite.url.config.get.rules" path="/admin/module/RewriteUrl/get-rules">
<default key="_controller">RewriteUrl\Controller\Admin\ModuleConfigController::getDatatableRules</default>
</route>
Expand Down
1 change: 1 addition & 0 deletions Controller/Admin/ModuleConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function getDatatableRules(Request $request)
'Value' => $this->renderRaw(
"RewriteUrl/tab-value-render",
[
"ID" => $row['Id'],
"REWRITE_URL_PARAMS" => $rewriteUrlRuleParams,
"VALUE" => $row['Value'],
]
Expand Down
27 changes: 26 additions & 1 deletion Hook/ConfigurationHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Model\ConfigQuery;

/**
* Class ConfigurationHook
Expand All @@ -22,10 +23,34 @@
*/
class ConfigurationHook extends BaseHook
{
public function onModuleConfiguration(HookRenderEvent $event)
{
$event->add(
$this->render(
'RewriteUrl/module-configuration.html',
[
"isRewritingEnabled" => ConfigQuery::isRewritingEnable()
]
)
);
}

public function onModuleConfigurationJavascript(HookRenderEvent $event)
{
$event->add(
$this->render(
'RewriteUrl/module-configuration-js.html',
[
"isRewritingEnabled" => ConfigQuery::isRewritingEnable()
]
)
);
}

public function onConfigurationCatalogTop(HookRenderEvent $event)
{
$event->add($this->render(
'configuration-catalog.html'
));
}
}
}
1 change: 1 addition & 0 deletions Service/RewritingRouterLast.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function matchRequest(Request $request) : array

$pathInfo = $request instanceof TheliaRequest ? $request->getRealPathInfo() : $request->getPathInfo();


/** @var RewriteurlRule $rule */
foreach ($ruleCollection as $rule) {
if ($rule->isMatching($pathInfo, $request->query->all())) {
Expand Down
25 changes: 0 additions & 25 deletions templates/backOffice/default/RewriteUrl/module-configuration.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
{extends file="admin-layout.tpl"}

{block name="no-return-functions"}
{$admin_current_location = 'modules'}
{/block}

{block name="page-title"}{intl l='RewriteUrl'}{/block}

{block name="check-auth"}
{check_auth role="ADMIN" module=$module_code access="view" login_tpl="/admin/login"}
{/block}

{block name="main-content"}
{default_translation_domain domain='rewriteurl.bo.default'}

<div class="modules-configure">
<div id="wrapper" class="container">
<div class="clearfix">
Expand All @@ -23,8 +8,6 @@
</ul>
</div>

{hook name="module.configuration" location="module_configuration" modulecode="$module_code"}

<div class="general-block-decorator">
<div class="row">
<div class="col-md-12">
Expand Down Expand Up @@ -155,14 +138,6 @@
</div>
</div>

{/block}

{block name="javascript-initialization"}

{include file="RewriteUrl/module-configuration-js.html"}
{/block}


{block name="javascript-last-call"}

{/block}

0 comments on commit 8619436

Please sign in to comment.