‪TYPO3CMS  10.4
LanguageColumn.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
26 
45 {
49  protected ‪$localizationConfiguration = [];
50 
54  protected ‪$grid;
55 
59  protected ‪$translationInfo = [
60  'hasStandaloneContent' => false,
61  'hasTranslations' => false,
62  'untranslatedRecordUids' => [],
63  ];
64 
66  {
67  parent::__construct(‪$context);
68  $this->localizationConfiguration = ‪BackendUtility::getPagesTSconfig(‪$context->‪getPageId())['mod.']['web_layout.']['localization.'] ?? [];
69  $this->grid = ‪$grid;
70  $this->translationInfo = ‪$translationInfo;
71  }
72 
73  public function ‪getGrid(): ?‪Grid
74  {
76  }
77 
78  public function ‪getPageIcon(): string
79  {
80  $localizedPageRecord = $this->context->getLocalizedPageRecord() ?? $this->context->getPageRecord();
82  $this->iconFactory->getIconForRecord('pages', $localizedPageRecord, ‪Icon::SIZE_SMALL)->render(),
83  'pages',
84  $localizedPageRecord['uid']
85  );
86  }
87 
88  public function ‪getAllowTranslate(): bool
89  {
90  return ($this->localizationConfiguration['enableTranslate'] ?? true) && !($this->‪getTranslationData()['hasStandAloneContent'] ?? false);
91  }
92 
93  public function ‪getTranslationData(): array
94  {
96  }
97 
98  public function ‪getAllowTranslateCopy(): bool
99  {
100  return ($this->localizationConfiguration['enableCopy'] ?? true) && !($this->‪getTranslationData()['hasTranslations'] ?? false);
101  }
102 
103  public function ‪getTranslatePageTitle(): string
104  {
105  return $this->‪getLanguageService()->getLL('newPageContent_translate');
106  }
107 
108  public function ‪getAllowEditPage(): bool
109  {
110  return $this->‪getBackendUser()->check('tables_modify', 'pages')
111  && $this->‪getBackendUser()->checkLanguageAccess($this->context->getSiteLanguage()->getLanguageId());
112  }
113 
114  public function ‪getPageEditTitle(): string
115  {
116  return $this->‪getLanguageService()->getLL('edit');
117  }
118 
119  public function ‪getPageEditUrl(): string
120  {
121  $pageRecordUid = $this->context->getLocalizedPageRecord()['uid'] ?? $this->context->getPageRecord()['uid'];
122  $urlParameters = [
123  'edit' => [
124  'pages' => [
125  $pageRecordUid => 'edit'
126  ]
127  ],
128  // Disallow manual adjustment of the language field for pages
129  'overrideVals' => [
130  'pages' => [
131  'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId()
132  ]
133  ],
134  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
135  ];
136  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
137  return (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
138  }
139 
140  public function ‪getAllowViewPage(): bool
141  {
142  return !‪VersionState::cast($this->context->getPageRecord()['t3ver_state'])->equals(‪VersionState::DELETE_PLACEHOLDER);
143  }
144 
145  public function ‪getViewPageLinkTitle(): string
146  {
147  return $this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage');
148  }
149 
150  public function ‪getViewPageOnClick(): string
151  {
152  $pageId = $this->context->getPageId();
154  $pageId,
155  '',
157  '',
158  '',
159  '&L=' . $this->context->getSiteLanguage()->getLanguageId()
160  );
161  }
162 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid
Definition: Grid.php:39
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\AbstractGridObject
Definition: AbstractGridObject.php:41
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getAllowViewPage
‪getAllowViewPage()
Definition: LanguageColumn.php:137
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getAllowEditPage
‪getAllowEditPage()
Definition: LanguageColumn.php:105
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getGrid
‪getGrid()
Definition: LanguageColumn.php:70
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\$localizationConfiguration
‪array $localizationConfiguration
Definition: LanguageColumn.php:48
‪TYPO3\CMS\Core\Versioning\VersionState\DELETE_PLACEHOLDER
‪const DELETE_PLACEHOLDER
Definition: VersionState.php:55
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\AbstractGridObject\$context
‪PageLayoutContext $context
Definition: AbstractGridObject.php:44
‪TYPO3\CMS\Backend\Utility\BackendUtility\BEgetRootLine
‪static array BEgetRootLine($uid, $clause='', $workspaceOL=false, array $additionalFields=[])
Definition: BackendUtility.php:343
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getTranslatePageTitle
‪getTranslatePageTitle()
Definition: LanguageColumn.php:100
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getViewPageLinkTitle
‪getViewPageLinkTitle()
Definition: LanguageColumn.php:142
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2510
‪TYPO3\CMS\Core\Type\Enumeration\cast
‪static static cast($value)
Definition: Enumeration.php:186
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\$translationInfo
‪array $translationInfo
Definition: LanguageColumn.php:56
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getAllowTranslate
‪getAllowTranslate()
Definition: LanguageColumn.php:85
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getPageEditTitle
‪getPageEditTitle()
Definition: LanguageColumn.php:111
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getTranslationData
‪getTranslationData()
Definition: LanguageColumn.php:90
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\AbstractGridObject\getBackendUser
‪getBackendUser()
Definition: AbstractGridObject.php:71
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:38
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getPageEditUrl
‪getPageEditUrl()
Definition: LanguageColumn.php:116
‪TYPO3\CMS\Backend\Utility\BackendUtility\getPagesTSconfig
‪static array getPagesTSconfig($id)
Definition: BackendUtility.php:698
‪TYPO3\CMS\Backend\View\BackendLayout\Grid
Definition: AbstractGridObject.php:18
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Core\Versioning\VersionState
Definition: VersionState.php:24
‪TYPO3\CMS\Backend\Utility\BackendUtility\viewOnClick
‪static string viewOnClick( $pageUid, $backPath='', $rootLine=null, $anchorSection='', $alternativeUrl='', $additionalGetVars='', $switchFocus=true)
Definition: BackendUtility.php:2359
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\__construct
‪__construct(PageLayoutContext $context, Grid $grid, array $translationInfo)
Definition: LanguageColumn.php:62
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getPageIcon
‪getPageIcon()
Definition: LanguageColumn.php:75
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getViewPageOnClick
‪getViewPageOnClick()
Definition: LanguageColumn.php:147
‪TYPO3\CMS\Backend\View\PageLayoutContext
Definition: PageLayoutContext.php:43
‪TYPO3\CMS\Backend\View\PageLayoutContext\getPageId
‪getPageId()
Definition: PageLayoutContext.php:174
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn
Definition: LanguageColumn.php:45
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\AbstractGridObject\getLanguageService
‪getLanguageService()
Definition: AbstractGridObject.php:66
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\getAllowTranslateCopy
‪getAllowTranslateCopy()
Definition: LanguageColumn.php:95
‪TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn\$grid
‪Grid null $grid
Definition: LanguageColumn.php:52