Skip to content

Commit

Permalink
Fix templates
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed Aug 7, 2024
1 parent 1d5f89c commit 7177e8c
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/Resources/contao/templates/dcbe_general_clipboard.html5
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Contao\StringUtil;
use Contao\System;
use ContaoCommunityAlliance\Contao\Bindings\ContaoEvents;
use ContaoCommunityAlliance\Contao\Bindings\Events\Image\GenerateHtmlEvent;
use ContaoCommunityAlliance\DcGeneral\Clipboard\ItemInterface;
Expand All @@ -9,7 +10,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
/** @var \ContaoCommunityAlliance\DcGeneral\EnvironmentInterface $environment */
$environment = $this->environment;
$eventDispatcher = $environment->getEventDispatcher();
$translator = \System::getContainer()->get('translator');
$translator = System::getContainer()->get('translator');
assert($translator instanceof TranslatorInterface);

// pre render the clipboard icon
Expand Down
5 changes: 3 additions & 2 deletions src/Resources/contao/templates/dcbe_general_common_list.html5
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

use Contao\StringUtil;
use Contao\System;
use ContaoCommunityAlliance\DcGeneral\Data\ModelId;
use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface;
use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\GroupAndSortingInformationInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

$requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = \System::getContainer()->get('translator');
$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = System::getContainer()->get('translator');
assert($translator instanceof TranslatorInterface);
?>
<?php $this->block('messages'); ?>
Expand Down
6 changes: 4 additions & 2 deletions src/Resources/contao/templates/dcbe_general_edit.html5
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

use Contao\StringUtil;
use Contao\System;
use ContaoCommunityAlliance\DcGeneral\Data\VersionModelInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

$requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = \System::getContainer()->get('translator');
$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = System::getContainer()->get('translator');
assert($translator instanceof TranslatorInterface);
// Add CSS
$GLOBALS['TL_CSS'][] = 'bundles/ccadcgeneral/css/generalDriver.css';
Expand Down
5 changes: 4 additions & 1 deletion src/Resources/contao/templates/dcbe_general_field.html5
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
$translator = \Contao\System::getContainer()->get('translator');

use Contao\System;

$translator = System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);
?>
<div id="widget_<?= $this->strName; ?>" class="widget <?= $this->strClass ?>">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
$requestToken = \Contao\System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = \Contao\System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);
use Contao\System;
use Symfony\Contracts\Translation\TranslatorInterface;

$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$translator = System::getContainer()->get('translator');
assert($translator instanceof TranslatorInterface);

$apply = $translator->trans(id: 'apply', domain: 'dc-general');
?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use Contao\StringUtil;
use Contao\System;
?>
<?php if ($this->language && !empty($this->languages)): ?>
<div class="tl_panel tl_language_panel">
<form action="<?= StringUtil::ampersand($this->request, true) ?>" id="language_switch" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="language_switch" />
<input type="hidden" name="REQUEST_TOKEN" value="<?= $this->REQUEST_TOKEN ?>" />
<label for="selectLanguage"><strong><?= \Contao\System::getContainer()->get('translator')->trans('language', [], 'dc-general') ?>: </strong></label>
<label for="selectLanguage"><strong><?= System::getContainer()->get('translator')->trans('language', [], 'dc-general') ?>: </strong></label>
<select name="language" id="selectLanguage" class="tl_select" onchange="Backend.autoSubmit('language_switch')">
<?php foreach ($this->languages as $langCode => $languageName) : ?>
<option value="<?= $langCode; ?>"<?php if ($langCode === $this->language): ?> selected="selected"<?php endif; ?>>
Expand Down
5 changes: 4 additions & 1 deletion src/Resources/contao/templates/dcbe_general_panel.html5
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
$requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();

use Contao\System;

$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
?>
<form action="<?= $this->action ?>" class="tl_form dc_general_panel" method="post">
<div class="tl_formbody">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
$translator = \Contao\System::getContainer()->get('translator');

use Contao\System;

$translator = System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);
?>
<div class="tl_limit tl_subpanel <?= $this->rowClass; ?>">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
$translator = \Contao\System::getContainer()->get('translator');

use Contao\System;

$translator = System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);
?>
<div class="tl_search tl_subpanel <?= $this->rowClass ?>">
Expand Down
5 changes: 4 additions & 1 deletion src/Resources/contao/templates/dcbe_general_panel_sort.html5
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
$translator = \Contao\System::getContainer()->get('translator');

use Contao\System;

$translator = System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);
?>
<div class="tl_sorting tl_subpanel <?= $this->rowClass; ?>">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
$translator = \Contao\System::getContainer()->get('translator');

use Contao\System;

$translator = System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);

$apply = $translator->trans(id: 'apply', domain: 'dc-general');
Expand Down
7 changes: 5 additions & 2 deletions src/Resources/contao/templates/dcbe_general_show.html5
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
use Contao\System;
use Symfony\Contracts\Translation\TranslatorInterface;

$this->insert(
'dcbe_general_language_selector',
[
Expand All @@ -10,8 +13,8 @@ $this->insert(
]
);

$translator = \Contao\System::getContainer()->get('translator');
assert($translator instanceof \Symfony\Contracts\Translation\TranslatorInterface);
$translator = System::getContainer()->get('translator');
assert($translator instanceof TranslatorInterface);
?>

<div id="tl_buttons">
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/contao/templates/dcbe_general_treeview.html5
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
use Contao\System;

$requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();

// Add tree view stylesheet
$GLOBALS['TL_CSS'][] = 'bundles/ccadcgeneral/css/generalTreeView.css';
Expand Down
3 changes: 1 addition & 2 deletions src/Resources/contao/templates/widget_common_picker.html5
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

use Contao\StringUtil;

$requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
?>
<input type="hidden" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" value="<?= \implode(',', \array_keys($this->values)) ?>">

Expand Down
3 changes: 2 additions & 1 deletion src/Resources/contao/templates/widget_filetree.html5
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use Contao\StringUtil;
use Contao\System;

$requestToken = \System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
$requestToken = System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
?>
<div>
<input type="hidden" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" value="<?= $this->value ?>">
Expand Down

0 comments on commit 7177e8c

Please sign in to comment.