D'autres fichiers en conf

This commit is contained in:
2021-01-25 18:44:19 +01:00
parent af1552b390
commit 154fff5134
74 changed files with 9151 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace PaymentCondition\Hook;
use PaymentCondition\Model\PaymentCustomerConditionQuery;
use PaymentCondition\Model\PaymentCustomerModuleConditionQuery;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class CustomerEditHook extends BaseHook
{
public function onCustomerEdit(HookRenderEvent $event)
{
$customerId = $event->getArgument('customer_id');
$paymentCustomerCondition = PaymentCustomerConditionQuery::create()
->findOneByCustomerId($customerId);
$paymentCustomerModuleConditions = PaymentCustomerModuleConditionQuery::create()
->findByCustomerId($customerId);
$allowedModules = [];
foreach ($paymentCustomerModuleConditions as $paymentCustomerModuleCondition) {
if ($paymentCustomerModuleCondition->getIsValid()) {
$allowedModules[] = $paymentCustomerModuleCondition->getModule();
}
}
$event->add($this->render('payment-condition/customer_edit_hook.html', compact('paymentCustomerCondition', 'allowedModules')));
}
}