From 355f547e0dada408969fc3ab65906e3452ab710b Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Sat, 4 Mar 2023 11:15:46 +0100 Subject: [PATCH 01/12] Bump the to Contao 5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 05354f9..2e3e5a4 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "php":">=7.4", "ext-json": "*", "ext-dom": "*", - "contao/core-bundle":"^4.13" + "contao/core-bundle":"^4.13 || ^5.1" }, "require-dev": { "contao/manager-plugin": "^2.0" From 4d8bd3e83264e46910acd8bc6b758444db587613 Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Sat, 4 Mar 2023 11:22:51 +0100 Subject: [PATCH 02/12] Set the data container class direct --- src/Resources/contao/dca/tl_style_manager.php | 4 +++- src/Resources/contao/dca/tl_style_manager_archive.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Resources/contao/dca/tl_style_manager.php b/src/Resources/contao/dca/tl_style_manager.php index 8c9219a..7315e18 100644 --- a/src/Resources/contao/dca/tl_style_manager.php +++ b/src/Resources/contao/dca/tl_style_manager.php @@ -5,11 +5,13 @@ * (c) https://www.oveleon.de/ */ +use Contao\DC_Table; + $GLOBALS['TL_DCA']['tl_style_manager'] = [ // Config 'config' => [ - 'dataContainer' => 'Table', + 'dataContainer' => DC_Table::class, 'ptable' => 'tl_style_manager_archive', 'switchToEdit' => true, 'enableVersioning' => true, diff --git a/src/Resources/contao/dca/tl_style_manager_archive.php b/src/Resources/contao/dca/tl_style_manager_archive.php index 92d2e40..904a0c1 100644 --- a/src/Resources/contao/dca/tl_style_manager_archive.php +++ b/src/Resources/contao/dca/tl_style_manager_archive.php @@ -5,10 +5,12 @@ * (c) https://www.oveleon.de/ */ +use Contao\DC_Table; + $GLOBALS['TL_DCA']['tl_style_manager_archive'] = [ // Config 'config' => [ - 'dataContainer' => 'Table', + 'dataContainer' => DC_Table::class, 'ctable' => ['tl_style_manager'], 'switchToEdit' => true, 'enableVersioning' => true, From 57b75b896cc15e5948bca9742e5e234ddf2b51e5 Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Mon, 6 Mar 2023 08:59:25 +0100 Subject: [PATCH 03/12] Set php to ^7.4 || ^8.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2e3e5a4..64d742f 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require":{ - "php":">=7.4", + "php":"^7.4 || ^8.0", "ext-json": "*", "ext-dom": "*", "contao/core-bundle":"^4.13 || ^5.1" From 6052a8fc69a1c9385333fa1a5b1d95773f12f106 Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Mon, 6 Mar 2023 09:38:07 +0100 Subject: [PATCH 04/12] Fix Services --- src/Widget/ComponentStyleSelect.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Widget/ComponentStyleSelect.php b/src/Widget/ComponentStyleSelect.php index ca56c17..030aba3 100644 --- a/src/Widget/ComponentStyleSelect.php +++ b/src/Widget/ComponentStyleSelect.php @@ -232,7 +232,7 @@ public function generate() return $this->renderEmptyMessage(); } - $objSession = System::getContainer()->get('session')->getBag('contao_backend'); + $objSession = System::getContainer()->get('request_stack')->getSession()->getBag('contao_backend'); $arrSession = $objSession->get('stylemanager_section_states'); $arrGroups = array(); @@ -269,7 +269,7 @@ public function generate() $this->id, $groupAlias, $identifier, - REQUEST_TOKEN + System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue() ); $arrNavigation[ $index ] = sprintf('', @@ -308,6 +308,17 @@ public function generate() return implode("", $arrSections); } + /** + * Return the empty message + * + * @return string + */ + private function renderEmptyMessage() + { + System::loadLanguageFile('tl_style_manager'); + return '

' . $GLOBALS['TL_LANG']['tl_style_manager']['noStylesDefined'] . '

'; + } + /** * Check for a valid option and prepare template variables */ @@ -346,15 +357,4 @@ public function validate() ->execute($value, $this->activeRecord->id); } } - - /** - * Return the empty message - * - * @return string - */ - private function renderEmptyMessage() - { - System::loadLanguageFile('tl_style_manager'); - return '

' . $GLOBALS['TL_LANG']['tl_style_manager']['noStylesDefined'] . '

'; - } } From 2777d8d297a29aedcaee553a07a2bf8973623769 Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Mon, 6 Mar 2023 11:06:05 +0100 Subject: [PATCH 05/12] Set container services in the constructor --- src/Widget/ComponentStyleSelect.php | 92 ++++++++++++++++++----------- 1 file changed, 58 insertions(+), 34 deletions(-) diff --git a/src/Widget/ComponentStyleSelect.php b/src/Widget/ComponentStyleSelect.php index 030aba3..13cabf4 100644 --- a/src/Widget/ComponentStyleSelect.php +++ b/src/Widget/ComponentStyleSelect.php @@ -8,6 +8,8 @@ namespace Oveleon\ContaoComponentStyleManager\Widget; use Contao\BackendUser; +use Contao\CoreBundle\Csrf\ContaoCsrfTokenManager; +use Contao\CoreBundle\InsertTag\InsertTagParser; use Contao\Database; use Contao\Input; use Contao\StringUtil; @@ -16,6 +18,7 @@ use Oveleon\ContaoComponentStyleManager\Model\StyleManagerArchiveModel; use Oveleon\ContaoComponentStyleManager\Model\StyleManagerModel; use Oveleon\ContaoComponentStyleManager\StyleManager\StyleManager; +use Symfony\Component\HttpFoundation\RequestStack; /** * Provide methods to handle select menus for style manager. @@ -27,33 +30,56 @@ * @property boolean $chosen * * @author Daniele Sciannimanica + * @author Daniel Jahnsmüller */ class ComponentStyleSelect extends Widget { - /** - * Submit user input - * @var boolean - */ - protected $blnSubmitInput = true; - - /** - * Template - * @var string - */ - protected $strTemplate = 'be_widget'; - - /** - * Generate the widget and return it as string - * - * @return string - */ - public function generate() - { + /** + * Submit user input + * @var boolean + */ + protected $blnSubmitInput = true; + + /** + * Template + * @var string + */ + protected $strTemplate = 'be_widget'; + + private ContaoCsrfTokenManager $tokenManager; + + private InsertTagParser $insertTagParser; + + private RequestStack $requestStack; + + private bool $showGroupTitle; + + + public function __construct($arrAttributes = null) + { + parent::__construct($arrAttributes); + + $container = System::getContainer(); + + $this->tokenManager = $container->get('contao.csrf.token_manager'); + $this->insertTagParser = $container->get('contao.insert_tag.parser'); + $this->requestStack = $container->get('request_stack'); + + $this->showGroupTitle = (bool) $container->getParameter('contao_component_style_manager.show_group_title'); + } + + /** + * Generate the widget and return it as string + * + * @return string + */ + public function generate() + { $arrObjStyleArchives = StyleManagerArchiveModel::findAllWithConfiguration(array('order'=>'sorting')); - $arrObjStyleGroups = StyleManagerModel::findByTableAndConfiguration($this->strTable, array('order'=>'pid,sorting')); + $arrObjStyleGroups = StyleManagerModel::findByTableAndConfiguration($this->strTable, array('order'=>'pid,sorting')); - if($arrObjStyleGroups === null || $arrObjStyleArchives === null) + if($arrObjStyleGroups === null || $arrObjStyleArchives === null) { return $this->renderEmptyMessage(); } @@ -64,7 +90,7 @@ public function generate() $arrOrder = array(); // Prepare archives - foreach($arrObjStyleArchives as $objStyleArchive) + foreach($arrObjStyleArchives as $objStyleArchive) { $arrArchives[ $objStyleArchive->id ] = array( 'title' => $objStyleArchive->title, @@ -80,9 +106,6 @@ public function generate() // Restore default values $this->varValue = StyleManager::deserializeValues($this->varValue); - // Show group title - $blnShowGroupTitle = System::getContainer()->getParameter('contao_component_style_manager.show_group_title'); - // Prepare group fields foreach($arrObjStyleGroups as $objStyleGroup) { @@ -227,12 +250,12 @@ public function generate() $isEmpty = false; } - if($isEmpty) - { + if($isEmpty) + { return $this->renderEmptyMessage(); } - $objSession = System::getContainer()->get('request_stack')->getSession()->getBag('contao_backend'); + $objSession = $this->requestStack->getSession()->getBag('contao_backend'); $arrSession = $objSession->get('stylemanager_section_states'); $arrGroups = array(); @@ -243,7 +266,7 @@ public function generate() return (array_search($key1, $arrOrder) > array_search($key2, $arrOrder)); }); - // collect groups + // collect groups foreach ($arrCollection as $alias => $collection) { $arrGroups[ $collection['group'] ][ $alias ] = $collection; @@ -269,7 +292,7 @@ public function generate() $this->id, $groupAlias, $identifier, - System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue() + $this->tokenManager->getDefaultTokenValue() ); $arrNavigation[ $index ] = sprintf('', @@ -283,12 +306,12 @@ public function generate() $arrContent[ $index ] = sprintf('
%s%s
', $identifier, - (trim($group['desc']) ? '
' . $this->replaceInsertTags(nl2br($group['desc'])) . '
' : ''), + (trim($group['desc']) ? '
' . $this->insertTagParser->replaceInline(nl2br($group['desc'])) . '
' : ''), implode("", $group['fields']) ); // Set group title if it exists - if ($blnShowGroupTitle && null !== $group['groupTitle']) + if ($this->showGroupTitle && null !== $group['groupTitle']) { $groupTitle = '

' . $group['groupTitle'] . '

'; } @@ -305,8 +328,8 @@ public function generate() $arrSections[] = '
' . $groupTitle . implode("", $arrNavigation) . implode("", $arrContent) . '
'; } - return implode("", $arrSections); - } + return implode("", $arrSections); + } /** * Return the empty message @@ -357,4 +380,5 @@ public function validate() ->execute($value, $this->activeRecord->id); } } + } From 1760d87fc78ade2550ffcd7c46f9d8ba070a35bd Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Mon, 6 Mar 2023 11:12:05 +0100 Subject: [PATCH 06/12] Generate route with router service --- .../DataContainer/StyleManagerArchiveListener.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/EventListener/DataContainer/StyleManagerArchiveListener.php b/src/EventListener/DataContainer/StyleManagerArchiveListener.php index b800eb8..ed6ed74 100644 --- a/src/EventListener/DataContainer/StyleManagerArchiveListener.php +++ b/src/EventListener/DataContainer/StyleManagerArchiveListener.php @@ -10,9 +10,19 @@ use Oveleon\ContaoComponentStyleManager\Controller\BackendModule\ImportController; use Oveleon\ContaoComponentStyleManager\Model\StyleManagerArchiveModel; use Oveleon\ContaoComponentStyleManager\StyleManager\Config; +use Symfony\Component\Routing\RouterInterface; class StyleManagerArchiveListener { + + private RouterInterface $router; + + + public function __construct(RouterInterface $router) + { + $this->router = $router; + } + /** * @Callback(table="tl_style_manager_archive", target="config.onload") */ @@ -54,7 +64,7 @@ public function importConfigButton(?string $href, string $label, string $title, } return vsprintf('%s ', [ - TL_SCRIPT. '/' . ImportController::ROUTE, + $this->router->generate(ImportController::class), $class, StringUtil::specialchars($title), $attributes, @@ -77,7 +87,7 @@ public function bundleConfigButton(?string $href, string $label, string $title, } return vsprintf('%s: %s', [ - TL_SCRIPT. '/' . ImportController::ROUTE, + $this->router->generate(ImportController::class), $class, $attributes, $label, From fd880a0874f2fccd5cd1f98ccf6fe2ff8fe44b0d Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Mon, 6 Mar 2023 12:55:59 +0100 Subject: [PATCH 07/12] Extend from AbstractBackendController --- .../BackendModule/ImportController.php | 138 +++++++++--------- src/Resources/views/import.html.twig | 10 +- 2 files changed, 71 insertions(+), 77 deletions(-) diff --git a/src/Controller/BackendModule/ImportController.php b/src/Controller/BackendModule/ImportController.php index 1e3fbf3..91f3f15 100644 --- a/src/Controller/BackendModule/ImportController.php +++ b/src/Controller/BackendModule/ImportController.php @@ -4,6 +4,8 @@ use Contao\Config; use Contao\Controller; +use Contao\CoreBundle\Controller\AbstractBackendController; +use Contao\CoreBundle\Csrf\ContaoCsrfTokenManager; use Contao\CoreBundle\Exception\RedirectResponseException; use Contao\Database; use Contao\File; @@ -14,31 +16,29 @@ use DOMDocument; use Oveleon\ContaoComponentStyleManager\Model\StyleManagerArchiveModel; use Oveleon\ContaoComponentStyleManager\Model\StyleManagerModel; +use Oveleon\ContaoComponentStyleManager\StyleManager\Config as BundleConfig; use Oveleon\ContaoComponentStyleManager\StyleManager\Sync; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; -use Oveleon\ContaoComponentStyleManager\StyleManager\Config as BundleConfig; -use Twig\Environment as TwigEnvironment; /** * @Route("%contao.backend.route_prefix%/style-manager-import", name=ImportController::class, defaults={"_scope": "backend"}) */ -class ImportController extends AbstractController +class ImportController extends AbstractBackendController { - const ROUTE = 'style-manager-import'; + public const ROUTE = 'style-manager-import'; - protected TwigEnvironment $twig; protected RequestStack $requestStack; protected TranslatorInterface $translator; + private ContaoCsrfTokenManager $tokenManager; - public function __construct(TwigEnvironment $twig, RequestStack $requestStack, TranslatorInterface $translator) + public function __construct(RequestStack $requestStack, TranslatorInterface $translator, ContaoCsrfTokenManager $tokenManager) { - $this->twig = $twig; $this->requestStack = $requestStack; $this->translator = $translator; + $this->tokenManager = $tokenManager; } public function __invoke(): Response @@ -85,7 +85,7 @@ public function __invoke(): Response $configs = $this->createImportTree(...$configs); } - return new Response($this->twig->render('@ContaoComponentStyleManager/import.html.twig', [ + return new Response($this->render('@ContaoComponentStyleManager/import.html.twig', [ 'headline' => $partial ? $this->translator->trans('tl_style_manager_import.importPartial', [], 'contao_default') : 'Import', 'messages' => Message::generate(), 'useBundleConfig' => System::getContainer()->getParameter('contao_component_style_manager.use_bundle_config'), @@ -94,12 +94,12 @@ public function __invoke(): Response 'configs' => $configs, 'form' => [ 'id' => 'style_manager_import', - 'rt' => System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue(), + 'rt' => $this->tokenManager->getDefaultTokenValue(), 'maxFileSize' => Config::get('maxFileSize'), 'uploadWidget' => $objUploader->generateMarkup() ], 'action' => [ - 'back' => str_replace('/' . self::ROUTE, '', TL_SCRIPT) . '?do=style_manager', + 'back' => str_replace('/' . self::ROUTE, '', $this->generateUrl('contao_backend')) . '?do=style_manager', ], 'label' => [ 'back' => $this->translator->trans('MSC.backBT', [], 'contao_default'), @@ -117,63 +117,6 @@ public function __invoke(): Response ])); } - /** - * Create a tree from archives and groups - */ - public function createImportTree($archives, $groups, $files): array - { - $collection = [ - 'files' => $files, - 'collection' => [] - ]; - - $_groups = $groups; - - // Check if archive exists - $getGroups = function (int $pid) use (&$_groups): array - { - $collection = []; - - foreach ($_groups ?? [] as $alias => &$group) - { - if($pid === $group->pid) - { - $collection[ $alias ] = $group; - - array_splice($_groups, array_search($alias, $_groups), 1); - } - } - - return $collection; - }; - - foreach ($archives ?? [] as $key => $archive) - { - $collection['collection'][ $key ] = [ - 'archive' => $archive, - 'children' => $getGroups((int) $archive->id) - ]; - } - - return $collection; - } - - /** - * Partial import - */ - private function importPartial(array $files, array $archives, array $groups): ?array - { - return $this->importFiles($files, true, $archives, $groups); - } - - /** - * Import based on bundle configurations - */ - public function importBundleConfigFiles(array $files, bool $partial = false): ?array - { - return $this->importFiles(array_map(fn($n) => html_entity_decode($n), $files), !$partial); - } - /** * Import using a FileUploader */ @@ -507,4 +450,61 @@ public static function importFiles(array $files, bool $blnSave = true, ?array $a return [$arrStyleArchives, $arrStyleGroups, $files]; } + + /** + * Partial import + */ + private function importPartial(array $files, array $archives, array $groups): ?array + { + return $this->importFiles($files, true, $archives, $groups); + } + + /** + * Import based on bundle configurations + */ + public function importBundleConfigFiles(array $files, bool $partial = false): ?array + { + return $this->importFiles(array_map(fn($n) => html_entity_decode($n), $files), !$partial); + } + + /** + * Create a tree from archives and groups + */ + public function createImportTree($archives, $groups, $files): array + { + $collection = [ + 'files' => $files, + 'collection' => [] + ]; + + $_groups = $groups; + + // Check if archive exists + $getGroups = function (int $pid) use (&$_groups): array + { + $collection = []; + + foreach ($_groups ?? [] as $alias => &$group) + { + if($pid === $group->pid) + { + $collection[ $alias ] = $group; + + array_splice($_groups, array_search($alias, $_groups), 1); + } + } + + return $collection; + }; + + foreach ($archives ?? [] as $key => $archive) + { + $collection['collection'][ $key ] = [ + 'archive' => $archive, + 'children' => $getGroups((int) $archive->id) + ]; + } + + return $collection; + } } diff --git a/src/Resources/views/import.html.twig b/src/Resources/views/import.html.twig index eb4e146..fd64bd1 100644 --- a/src/Resources/views/import.html.twig +++ b/src/Resources/views/import.html.twig @@ -1,12 +1,6 @@ -{% extends "@ContaoCore/Backend/be_page.html.twig" %} +{% extends "@Contao/be_main" %} -{% block headline %} - {{ headline }} -{% endblock %} - -{% block error %}{% endblock %} - -{% block main %} +{% block main_content %} {% if messages %} {{ messages|raw }} {% endif %} From 131f9cb5a0e8360422c2f59165fbadfcc589e52a Mon Sep 17 00:00:00 2001 From: Tastaturberuf Date: Mon, 6 Mar 2023 13:07:45 +0100 Subject: [PATCH 08/12] Rearrange methods --- .../BackendModule/ImportController.php | 114 +++++++++--------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/Controller/BackendModule/ImportController.php b/src/Controller/BackendModule/ImportController.php index 91f3f15..1572701 100644 --- a/src/Controller/BackendModule/ImportController.php +++ b/src/Controller/BackendModule/ImportController.php @@ -117,6 +117,63 @@ public function __invoke(): Response ])); } + /** + * Create a tree from archives and groups + */ + public function createImportTree($archives, $groups, $files): array + { + $collection = [ + 'files' => $files, + 'collection' => [] + ]; + + $_groups = $groups; + + // Check if archive exists + $getGroups = function (int $pid) use (&$_groups): array + { + $collection = []; + + foreach ($_groups ?? [] as $alias => &$group) + { + if($pid === $group->pid) + { + $collection[ $alias ] = $group; + + array_splice($_groups, array_search($alias, $_groups), 1); + } + } + + return $collection; + }; + + foreach ($archives ?? [] as $key => $archive) + { + $collection['collection'][ $key ] = [ + 'archive' => $archive, + 'children' => $getGroups((int) $archive->id) + ]; + } + + return $collection; + } + + /** + * Partial import + */ + private function importPartial(array $files, array $archives, array $groups): ?array + { + return $this->importFiles($files, true, $archives, $groups); + } + + /** + * Import based on bundle configurations + */ + public function importBundleConfigFiles(array $files, bool $partial = false): ?array + { + return $this->importFiles(array_map(fn($n) => html_entity_decode($n), $files), !$partial); + } + /** * Import using a FileUploader */ @@ -450,61 +507,4 @@ public static function importFiles(array $files, bool $blnSave = true, ?array $a return [$arrStyleArchives, $arrStyleGroups, $files]; } - - /** - * Partial import - */ - private function importPartial(array $files, array $archives, array $groups): ?array - { - return $this->importFiles($files, true, $archives, $groups); - } - - /** - * Import based on bundle configurations - */ - public function importBundleConfigFiles(array $files, bool $partial = false): ?array - { - return $this->importFiles(array_map(fn($n) => html_entity_decode($n), $files), !$partial); - } - - /** - * Create a tree from archives and groups - */ - public function createImportTree($archives, $groups, $files): array - { - $collection = [ - 'files' => $files, - 'collection' => [] - ]; - - $_groups = $groups; - - // Check if archive exists - $getGroups = function (int $pid) use (&$_groups): array - { - $collection = []; - - foreach ($_groups ?? [] as $alias => &$group) - { - if($pid === $group->pid) - { - $collection[ $alias ] = $group; - - array_splice($_groups, array_search($alias, $_groups), 1); - } - } - - return $collection; - }; - - foreach ($archives ?? [] as $key => $archive) - { - $collection['collection'][ $key ] = [ - 'archive' => $archive, - 'children' => $getGroups((int) $archive->id) - ]; - } - - return $collection; - } } From 000f0a2d47c2615b1afcf8759d95f25bdd5c7e67 Mon Sep 17 00:00:00 2001 From: Sebastian Zoglowek Date: Mon, 13 Mar 2023 10:25:30 +0100 Subject: [PATCH 09/12] Update documentation - template variables do not work within Twig-Templates -> use legacy templates instead --- docs/TEMPLATE_VARIABLES.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/TEMPLATE_VARIABLES.md b/docs/TEMPLATE_VARIABLES.md index 56cddc4..ac3940b 100644 --- a/docs/TEMPLATE_VARIABLES.md +++ b/docs/TEMPLATE_VARIABLES.md @@ -8,6 +8,29 @@ --- +### As Twig ist not yet fully supported (Contao ^5.1), this feature will only work with Legacy-Templates) +https://docs.contao.org/dev/framework/templates/legacy/ + +> To use legacy-templates (html5) in contao ^5.1, you can force this by overwriting config.php in "/contao/config/config.php". +```php + Date: Mon, 13 Mar 2023 11:00:35 +0100 Subject: [PATCH 10/12] Fixes rendering issue within ImportController --- src/Controller/BackendModule/ImportController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/BackendModule/ImportController.php b/src/Controller/BackendModule/ImportController.php index 1572701..e502d87 100644 --- a/src/Controller/BackendModule/ImportController.php +++ b/src/Controller/BackendModule/ImportController.php @@ -85,7 +85,7 @@ public function __invoke(): Response $configs = $this->createImportTree(...$configs); } - return new Response($this->render('@ContaoComponentStyleManager/import.html.twig', [ + return $this->render('@ContaoComponentStyleManager/import.html.twig', [ 'headline' => $partial ? $this->translator->trans('tl_style_manager_import.importPartial', [], 'contao_default') : 'Import', 'messages' => Message::generate(), 'useBundleConfig' => System::getContainer()->getParameter('contao_component_style_manager.use_bundle_config'), @@ -114,7 +114,7 @@ public function __invoke(): Response 'bundleConfigEmpty' => $this->translator->trans('tl_style_manager_import.bundleConfigEmpty', [], 'contao_default'), 'bundleConfigInactive' => $this->translator->trans('tl_style_manager_import.bundleConfigInactive', [], 'contao_default'), ] - ])); + ]); } /** From f7da42188e5418e74b7b22bda3da26d69a14560e Mon Sep 17 00:00:00 2001 From: Sebastian Zoglowek Date: Mon, 13 Mar 2023 11:01:14 +0100 Subject: [PATCH 11/12] Correctly display about-icon within contao ^5.1 --- src/Resources/public/icons/about.svg | 1 + src/Resources/views/import.html.twig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 src/Resources/public/icons/about.svg diff --git a/src/Resources/public/icons/about.svg b/src/Resources/public/icons/about.svg new file mode 100644 index 0000000..4aa6a8a --- /dev/null +++ b/src/Resources/public/icons/about.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Resources/views/import.html.twig b/src/Resources/views/import.html.twig index fd64bd1..6a6229c 100644 --- a/src/Resources/views/import.html.twig +++ b/src/Resources/views/import.html.twig @@ -82,7 +82,7 @@

{{ label.bundleUpload }} - +

{% if useBundleConfig %} From c98608e30b638ebd36c2b797f7caff8b5f33525d Mon Sep 17 00:00:00 2001 From: Sebastian Zoglowek Date: Mon, 13 Mar 2023 11:16:55 +0100 Subject: [PATCH 12/12] Fix typo --- docs/TEMPLATE_VARIABLES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/TEMPLATE_VARIABLES.md b/docs/TEMPLATE_VARIABLES.md index ac3940b..f9bbd1e 100644 --- a/docs/TEMPLATE_VARIABLES.md +++ b/docs/TEMPLATE_VARIABLES.md @@ -8,7 +8,7 @@ --- -### As Twig ist not yet fully supported (Contao ^5.1), this feature will only work with Legacy-Templates) +### As Twig is not yet fully supported (Contao ^5.1), this feature will only work with Legacy-Templates) https://docs.contao.org/dev/framework/templates/legacy/ > To use legacy-templates (html5) in contao ^5.1, you can force this by overwriting config.php in "/contao/config/config.php".