-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAdminPsOnePageCheckoutController.php
More file actions
53 lines (42 loc) · 1.29 KB
/
AdminPsOnePageCheckoutController.php
File metadata and controls
53 lines (42 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Back office entry point for ps_onepagecheckout settings.
*/
use PrestaShop\PrestaShop\Core\Context\LegacyControllerContext;
use Twig\Environment;
class AdminPsOnePageCheckoutController extends ModuleAdminController
{
public function __construct()
{
$this->bootstrap = true;
parent::__construct();
}
public function initContent()
{
parent::initContent();
$configurationContent = $this->getBackOfficeConfigurationContent();
if ($configurationContent !== '') {
$this->content .= $configurationContent;
$this->context->smarty->assign('content', $this->content);
}
}
protected function getBackOfficeConfigurationContent(): string
{
if (!$this->module instanceof Ps_Onepagecheckout) {
return '';
}
return $this->module->getBackOfficeConfigurationContent();
}
public function getTwig(): ?Environment
{
try {
$legacyControllerContext = $this->getContainer()->get(LegacyControllerContext::class);
} catch (Throwable) {
return null;
}
if (!$legacyControllerContext instanceof LegacyControllerContext) {
return null;
}
return $legacyControllerContext->getTwig();
}
}