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

Twig component: Create global layout #33864

Merged
merged 5 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
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
67 changes: 12 additions & 55 deletions admin-dev/themes/new-theme/template/layout.tpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<!DOCTYPE html>
<html lang="{$iso}">
<head>
{render_template
smarty_template="header.tpl"
twig_template="@PrestaShop/Admin/Layout/head.html.twig"
meta_title=$meta_title
}
{$header}
</head>

<body
Expand All @@ -26,25 +22,16 @@
<span id="shop_version">{$ps_version}</span>

<div class="component" id="quick-access-container">
{render_template
smarty_template="components/layout/quick_access.tpl"
twig_template="@PrestaShop/Admin/Layout/quick_access.html.twig"
}
{include file="components/layout/quick_access.tpl"}
</div>
<div class="component component-search" id="header-search-container">
<div class="component-search-body">
<div class="component-search-top">

{render_template
smarty_template="components/layout/search_form.tpl"
twig_template="@PrestaShop/Admin/Layout/search_form.html.twig"
}
{include file="components/layout/search_form.tpl"}
<button class="component-search-cancel d-none">{l|escape s='Cancel' d='Admin.Actions'}</button>
</div>
{render_template
smarty_template="components/layout/mobile_quickaccess.tpl"
twig_template="@PrestaShop/Admin/Layout/mobile_quick_access.html.twig"
}

{include file="components/layout/mobile_quickaccess.tpl"}
</div>

<div class="component-search-background d-none"></div>
Expand Down Expand Up @@ -103,31 +90,17 @@
<div class="header-right">
{if !isset($hideLegacyStoreContextSelector) || !$hideLegacyStoreContextSelector}
<div class="component" id="header-shop-list-container">
{render_template
smarty_template="components/layout/shop_list.tpl"
twig_template="@PrestaShop/Admin/Layout/shop_list.html.twig"
base_url=$base_url
is_multishop= $is_multishop|default:null
shop_list= $shop_list|default:null
multishop_context= $multishop_context|default:null
current_shop_name= $current_shop_name|default:null
}
{include file="components/layout/shop_list.tpl"}
</div>
{/if}
{if $show_new_orders || $show_new_customers || $show_new_messages}
<div class="component header-right-component" id="header-notifications-container">
{render_template
smarty_template="components/layout/notifications_center.tpl"
twig_template="@PrestaShop/Admin/Layout/notifications_center.html.twig"
}
{include file="components/layout/notifications_center.tpl"}
</div>
{/if}

<div class="component" id="header-employee-container">
{render_template
smarty_template="components/layout/employee_dropdown.tpl"
twig_template="@PrestaShop/Admin/Layout/employee_dropdown.html.twig"
}
{include file="components/layout/employee_dropdown.tpl"}
</div>
{if isset($displayBackOfficeTop)}{$displayBackOfficeTop}{/if}
</div>
Expand All @@ -136,24 +109,11 @@
{/if}

{if $display_header}
{render_template
smarty_template="components/layout/nav_bar.tpl"
twig_template="@PrestaShop/Admin/Layout/nav_bar.html.twig"
}
{include file='components/layout/nav_bar.tpl'}
{/if}

{if isset($page_header_toolbar_template)}
{render_template
smarty_template=$page_header_toolbar_template
twig_template="@PrestaShop/Admin/Layout/toolbar.html.twig"
locked_to_all_shop_context=$locked_to_all_shop_context
title=$title
toolbar_btn=$toolbar_btn
table=$table
help_link=$help_link
enableSidebar=$enableSidebar
use_regular_h1_structure=$use_regular_h1_structure
}
{if isset($page_header_toolbar)}
{$page_header_toolbar}
{/if}

<div id="main-div">
Expand Down Expand Up @@ -186,10 +146,7 @@
<div class="mobile-layer"></div>

{if $display_footer}
{render_template
smarty_template="footer.tpl"
twig_template="@PrestaShop/Admin/Layout/footer.html.twig"
}
{include file='footer.tpl'}
{/if}
{/if}

Expand Down
8 changes: 0 additions & 8 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@ public function getRootDir()
return __DIR__;
}

/**
* {@inheritdoc}
*/
public function getCacheDir()
{
return _PS_CACHE_DIR_;
}

/**
* {@inheritdoc}
*/
Expand Down
1 change: 1 addition & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ twig:
'%prestashop_views%': PrestaShopCore
'%kernel.project_dir%/admin-dev/themes/new-theme': AdminNewTheme
globals:
ps: '@PrestaShopBundle\Twig\Layout\PrestaShopLayoutGlobalVariables'
webpack_server: false
multistore_field_prefix: !php/const PrestaShopBundle\Service\Form\MultistoreCheckboxEnabler::MULTISTORE_FIELD_PREFIX
modify_all_shops_prefix: !php/const PrestaShopBundle\Form\Extension\ModifyAllShopsExtension::MODIFY_ALL_SHOPS_PREFIX
Expand Down
18 changes: 10 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion config/smarty.config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ function smartyEscape($string, $esc_type = 'html', $char_set = null, $double_enc
smartyRegisterFunction($smarty, 'modifier', 'classname', 'smartyClassname');
smartyRegisterFunction($smarty, 'modifier', 'classnames', 'smartyClassnames');
smartyRegisterFunction($smarty, 'function', 'url', array('Link', 'getUrlSmarty'));
smartyRegisterFunction($smarty, 'function', 'render_template', 'renderTemplate');

// Native PHP functions
smartyRegisterFunction($smarty, 'modifier', 'addcslashes', 'addcslashes');
Expand Down
2 changes: 1 addition & 1 deletion install-dev/controllers/console/process.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ private function initKernel()
private function rebootWithoutTranslationsCache()
{
global $kernel;
(new Filesystem())->remove($kernel->getCacheDir() . 'translations');
(new Filesystem())->remove($kernel->getCacheDir() . DIRECTORY_SEPARATOR . 'translations');
$kernel->reboot($kernel->getCacheDir());
}
}
77 changes: 26 additions & 51 deletions phpstan-tmp-legacy-layout-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
parameters:
ignoreErrors:
-
message: "#^Class Employee is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/EmployeeDropdown.php

-
message: "#^Namespace Context is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
message: "#^Class Shop is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/EmployeeDropdown.php
path: src/PrestaShopBundle/Twig/Component/HeadTag.php

-
message: "#^Namespace Employee is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
message: "#^Namespace Context is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/EmployeeDropdown.php
path: src/PrestaShopBundle/Twig/Component/HeadTag.php

-
message: "#^Namespace Media is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/Head.php

-
message: "#^Namespace Tools is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 3
path: src/PrestaShopBundle/Twig/Component/Head.php
path: src/PrestaShopBundle/Twig/Component/HeadTag.php

-
message: "#^Namespace Shop is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 3
path: src/PrestaShopBundle/Twig/Component/Head.php
path: src/PrestaShopBundle/Twig/Component/HeadTag.php

-
message: "#^Class Shop is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/Head.php
message: "#^Namespace Tools is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 3
path: src/PrestaShopBundle/Twig/Component/HeadTag.php

-
message: "#^Class Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/MobileQuickAccess.php
count: 2
path: src/PrestaShopBundle/Twig/Component/MultistoreHeader.php

-
message: "#^Namespace Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/MobileQuickAccess.php
path: src/PrestaShopBundle/Twig/Component/MultistoreHeader.php

-
message: "#^Class Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
message: "#^Namespace Configuration is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/MultistoreHeader.php
path: src/PrestaShopBundle/Twig/Component/NavBar.php

-
message: "#^Namespace Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/MultistoreHeader.php
message: "#^Namespace Dispatcher is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/NavBar.php

-
message: "#^Namespace Tab is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 5
path: src/PrestaShopBundle/Twig/Component/NavBar.php

-
message: "#^Class Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
Expand Down Expand Up @@ -86,31 +81,11 @@ parameters:
path: src/PrestaShopBundle/Twig/Component/QuickAccess.php

-
message: "#^Class Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/SearchForm.php

-
message: "#^Namespace Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/SearchForm.php

-
message: "#^Namespace Configuration is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
message: "#^Namespace Shop is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/NavBar.php
path: src/PrestaShopBundle/Twig/Layout/PrestaShopLayoutGlobalVariables.php

-
message: "#^Namespace Dispatcher is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
message: "#^Namespace Tools is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 2
path: src/PrestaShopBundle/Twig/Component/NavBar.php

-
message: "#^Namespace Link is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 1
path: src/PrestaShopBundle/Twig/Component/NavBar.php

-
message: "#^Namespace Tab is forbidden, No legacy calls inside the prestashop bundle\\. Please create an interface and an adapter if you need to\\.$#"
count: 5
path: src/PrestaShopBundle/Twig/Component/NavBar.php
path: src/PrestaShopBundle/Twig/Layout/PrestaShopLayoutGlobalVariables.php