Skip to content

Commit

Permalink
Add displayHeader and displayFooter admin controller layout
Browse files Browse the repository at this point in the history
  • Loading branch information
PululuK committed Mar 13, 2024
1 parent 0db88b0 commit 65ea4e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion controllers/admin/AdminLegacyLayoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public function __construct(
$helpLink = '',
$jsRouterMetadata = [],
$metaTitle = '',
$useRegularH1Structure = true
$useRegularH1Structure = true,
$displayHeader = true,
$displayFooter = true
) {
// Compatibility with legacy behavior.
// Some controllers can only be used in "All stores" context.
Expand Down Expand Up @@ -125,6 +127,8 @@ public function __construct(
$this->className = 'LegacyLayout';
$this->jsRouterMetadata = $jsRouterMetadata;
$this->useRegularH1Structure = $useRegularH1Structure;
$this->display_header = $displayHeader;
$this->display_footer = $displayFooter;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/Adapter/LegacyContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ public function getLegacyLayout(
$jsRouterMetadata = [],
$metaTitle = '',
$useRegularH1Structure = true,
$baseLayout = 'layout.tpl'
$baseLayout = 'layout.tpl',
$displayHeader = true,
$displayFooter = true
) {
$originCtrl = new AdminLegacyLayoutControllerCore(
$controllerName,
Expand All @@ -236,7 +238,9 @@ public function getLegacyLayout(
$helpLink,
$jsRouterMetadata,
$metaTitle,
$useRegularH1Structure
$useRegularH1Structure,
$displayHeader,
$displayFooter
);
$originCtrl->layout = $baseLayout;
$originCtrl->run();
Expand Down
6 changes: 5 additions & 1 deletion src/PrestaShopBundle/Resources/views/Admin/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
{% set showContentHeader = showContentHeader is defined ? showContentHeader : true %}
{% set layoutHeaderToolbarBtn = layoutHeaderToolbarBtn is defined ? layoutHeaderToolbarBtn : [] %}
{% set metaTitle = meta_title is defined ? meta_title : (layoutTitle is defined ? layoutTitle : '') %}
{% set displayHeader = displayHeader is defined ? displayHeader : true %}
{% set displayFooter = displayFooter is defined ? displayFooter : true %}

{# if the Symfony layout feature flag is enabled, we display the default layout or the light layout, #}
{# otherwise we display the legacy layout #}
Expand All @@ -44,7 +46,9 @@
js_router_metadata(),
meta_title is defined ? meta_title : '',
use_regular_h1_structure is defined ? use_regular_h1_structure : true,
legacyBaseLayout is defined ? legacyBaseLayout : 'layout.tpl'
legacyBaseLayout is defined ? legacyBaseLayout : 'layout.tpl',
displayHeader,
displayFooter
)
)
) %}
Expand Down

0 comments on commit 65ea4e9

Please sign in to comment.