0f242a43ddd9e7d261b472d16b8410289b734527
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / View / PageLayoutView.php
1 <?php
2
3 namespace TYPO3\CMS\Backend\View;
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
18 use Doctrine\DBAL\Driver\Statement;
19 use Psr\Log\LoggerAwareInterface;
20 use Psr\Log\LoggerAwareTrait;
21 use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
22 use TYPO3\CMS\Backend\Controller\Page\LocalizationController;
23 use TYPO3\CMS\Backend\Controller\PageLayoutController;
24 use TYPO3\CMS\Backend\Routing\Router;
25 use TYPO3\CMS\Backend\Routing\UriBuilder;
26 use TYPO3\CMS\Backend\Tree\View\PageTreeView;
27 use TYPO3\CMS\Backend\Utility\BackendUtility;
28 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
29 use TYPO3\CMS\Core\Database\Connection;
30 use TYPO3\CMS\Core\Database\ConnectionPool;
31 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
32 use TYPO3\CMS\Core\Database\Query\QueryHelper;
33 use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
34 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
35 use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
36 use TYPO3\CMS\Core\Imaging\Icon;
37 use TYPO3\CMS\Core\Imaging\IconFactory;
38 use TYPO3\CMS\Core\Localization\LanguageService;
39 use TYPO3\CMS\Core\Messaging\FlashMessage;
40 use TYPO3\CMS\Core\Messaging\FlashMessageService;
41 use TYPO3\CMS\Core\Page\PageRenderer;
42 use TYPO3\CMS\Core\Service\DependencyOrderingService;
43 use TYPO3\CMS\Core\Type\Bitmask\Permission;
44 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
45 use TYPO3\CMS\Core\Utility\GeneralUtility;
46 use TYPO3\CMS\Core\Utility\HttpUtility;
47 use TYPO3\CMS\Core\Utility\MathUtility;
48 use TYPO3\CMS\Core\Utility\StringUtility;
49 use TYPO3\CMS\Core\Versioning\VersionState;
50 use TYPO3\CMS\Extbase\Service\FlexFormService;
51 use TYPO3\CMS\Fluid\View\StandaloneView;
52 use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
53
54 /**
55 * Child class for the Web > Page module
56 */
57 class PageLayoutView implements LoggerAwareInterface
58 {
59 use LoggerAwareTrait;
60
61 /**
62 * If TRUE, users/groups are shown in the page info box.
63 *
64 * @var int
65 */
66 public $pI_showUser = 0;
67
68 /**
69 * The number of successive records to edit when showing content elements.
70 *
71 * @var int
72 */
73 public $nextThree = 3;
74
75 /**
76 * If TRUE, disables the edit-column icon for tt_content elements
77 *
78 * @var int
79 */
80 public $pages_noEditColumns = 0;
81
82 /**
83 * If TRUE, new-wizards are linked to rather than the regular new-element list.
84 *
85 * @var int
86 */
87 public $option_newWizard = 1;
88
89 /**
90 * If set to "1", will link a big button to content element wizard.
91 *
92 * @var int
93 */
94 public $ext_function = 0;
95
96 /**
97 * If TRUE, elements will have edit icons (probably this is whether the user has permission to edit the page content). Set externally.
98 *
99 * @var int
100 */
101 public $doEdit = 1;
102
103 /**
104 * Age prefixes for displaying times. May be set externally to localized values.
105 *
106 * @var string
107 */
108 public $agePrefixes = ' min| hrs| days| yrs| min| hour| day| year';
109
110 /**
111 * Array of tables to be listed by the Web > Page module in addition to the default tables.
112 *
113 * @var array
114 */
115 public $externalTables = [];
116
117 /**
118 * "Pseudo" Description -table name
119 *
120 * @var string
121 */
122 public $descrTable;
123
124 /**
125 * If set TRUE, the language mode of tt_content elements will be rendered with hard binding between
126 * default language content elements and their translations!
127 *
128 * @var bool
129 */
130 public $defLangBinding = false;
131
132 /**
133 * External, static: Configuration of tt_content element display:
134 *
135 * @var array
136 */
137 public $tt_contentConfig = [
138 // Boolean: Display info-marks or not
139 'showInfo' => 1,
140 // Boolean: Display up/down arrows and edit icons for tt_content records
141 'showCommands' => 1,
142 'languageCols' => 0,
143 'languageMode' => 0,
144 'languageColsPointer' => 0,
145 'showHidden' => 1,
146 // Displays hidden records as well
147 'sys_language_uid' => 0,
148 // Which language
149 'cols' => '1,0,2,3',
150 'activeCols' => '1,0,2,3'
151 // Which columns can be accessed by current BE user
152 ];
153
154 /**
155 * Contains icon/title of pages which are listed in the tables menu (see getTableMenu() function )
156 *
157 * @var array
158 */
159 public $activeTables = [];
160
161 /**
162 * @var array
163 */
164 public $tt_contentData = [
165 'nextThree' => [],
166 'prev' => [],
167 'next' => []
168 ];
169
170 /**
171 * Used to store labels for CTypes for tt_content elements
172 *
173 * @var array
174 */
175 public $CType_labels = [];
176
177 /**
178 * Used to store labels for the various fields in tt_content elements
179 *
180 * @var array
181 */
182 public $itemLabels = [];
183
184 /**
185 * Indicates if all available fields for a user should be selected or not.
186 *
187 * @var int
188 */
189 public $allFields = 0;
190
191 /**
192 * Number of records to show
193 *
194 * @var int
195 */
196 public $showLimit = 0;
197
198 /**
199 * Shared module configuration, used by localization features
200 *
201 * @var array
202 */
203 public $modSharedTSconfig = [];
204
205 /**
206 * Tables which should not get listed
207 *
208 * @var string
209 */
210 public $hideTables = '';
211
212 /**
213 * Containing which fields to display in extended mode
214 *
215 * @var string[]
216 */
217 public $displayFields;
218
219 /**
220 * Tables which should not list their translations
221 *
222 * @var string
223 */
224 public $hideTranslations = '';
225
226 /**
227 * If set, csvList is outputted.
228 *
229 * @var bool
230 */
231 public $csvOutput = false;
232
233 /**
234 * Cache for record path
235 *
236 * @var mixed[]
237 */
238 public $recPath_cache = [];
239
240 /**
241 * Field, to sort list by
242 *
243 * @var string
244 */
245 public $sortField;
246
247 /**
248 * default Max items shown per table in "multi-table mode", may be overridden by tables.php
249 *
250 * @var int
251 */
252 public $itemsLimitPerTable = 20;
253
254 /**
255 * Page select permissions
256 *
257 * @var string
258 */
259 public $perms_clause = '';
260
261 /**
262 * Page id
263 *
264 * @var int
265 */
266 public $id;
267
268 /**
269 * Return URL
270 *
271 * @var string
272 */
273 public $returnUrl = '';
274
275 /**
276 * Tablename if single-table mode
277 *
278 * @var string
279 */
280 public $table = '';
281
282 /**
283 * Some permissions...
284 *
285 * @var int
286 */
287 public $calcPerms = 0;
288
289 /**
290 * Mode for what happens when a user clicks the title of a record.
291 *
292 * @var string
293 */
294 public $clickTitleMode = '';
295
296 /**
297 * Levels to search down.
298 *
299 * @var int
300 */
301 public $searchLevels = '';
302
303 /**
304 * "LIMIT " in SQL...
305 *
306 * @var int
307 */
308 public $iLimit = 0;
309
310 /**
311 * Set to the total number of items for a table when selecting.
312 *
313 * @var string
314 */
315 public $totalItems = '';
316
317 /**
318 * TSconfig which overwrites TCA-Settings
319 *
320 * @var mixed[][]
321 */
322 public $tableTSconfigOverTCA = [];
323
324 /**
325 * Loaded with page record with version overlay if any.
326 *
327 * @var string[]
328 */
329 public $pageRecord = [];
330
331 /**
332 * Used for tracking duplicate values of fields
333 *
334 * @var string[]
335 */
336 public $duplicateStack = [];
337
338 /**
339 * Fields to display for the current table
340 *
341 * @var string[]
342 */
343 public $setFields = [];
344
345 /**
346 * Current script name
347 *
348 * @var string
349 */
350 public $script = 'index.php';
351
352 /**
353 * If TRUE, records are listed only if a specific table is selected.
354 *
355 * @var bool
356 */
357 public $listOnlyInSingleTableMode = false;
358
359 /**
360 * JavaScript code accumulation
361 *
362 * @var string
363 */
364 public $JScode = '';
365
366 /**
367 * Pointer for browsing list
368 *
369 * @var int
370 */
371 public $firstElementNumber = 0;
372
373 /**
374 * Counting the elements no matter what...
375 *
376 * @var int
377 */
378 public $eCounter = 0;
379
380 /**
381 * Search string
382 *
383 * @var string
384 */
385 public $searchString = '';
386
387 /**
388 * default Max items shown per table in "single-table mode", may be overridden by tables.php
389 *
390 * @var int
391 */
392 public $itemsLimitSingleTable = 100;
393
394 /**
395 * Field, indicating to sort in reverse order.
396 *
397 * @var bool
398 */
399 public $sortRev;
400
401 /**
402 * String, can contain the field name from a table which must have duplicate values marked.
403 *
404 * @var string
405 */
406 public $duplicateField;
407
408 /**
409 * Specify a list of tables which are the only ones allowed to be displayed.
410 *
411 * @var string
412 */
413 public $tableList = '';
414
415 /**
416 * Array of collapsed / uncollapsed tables in multi table view
417 *
418 * @var int[][]
419 */
420 public $tablesCollapsed = [];
421
422 /**
423 * @var array[] Module configuration
424 */
425 public $modTSconfig;
426
427 /**
428 * HTML output
429 *
430 * @var string
431 */
432 public $HTMLcode = '';
433
434 /**
435 * Thumbnails on records containing files (pictures)
436 *
437 * @var bool
438 */
439 public $thumbs = 0;
440
441 /**
442 * Used for tracking next/prev uids
443 *
444 * @var int[][]
445 */
446 public $currentTable = [];
447
448 /**
449 * OBSOLETE - NOT USED ANYMORE. leftMargin
450 *
451 * @var int
452 */
453 public $leftMargin = 0;
454
455 /**
456 * Decides the columns shown. Filled with values that refers to the keys of the data-array. $this->fieldArray[0] is the title column.
457 *
458 * @var array
459 */
460 public $fieldArray = [];
461
462 /**
463 * Set to zero, if you don't want a left-margin with addElement function
464 *
465 * @var int
466 */
467 public $setLMargin = 1;
468
469 /**
470 * Contains page translation languages
471 *
472 * @var array
473 */
474 public $pageOverlays = [];
475
476 /**
477 * Counter increased for each element. Used to index elements for the JavaScript-code that transfers to the clipboard
478 *
479 * @var int
480 */
481 public $counter = 0;
482
483 /**
484 * Contains sys language icons and titles
485 *
486 * @var array
487 */
488 public $languageIconTitles = [];
489
490 /**
491 * Script URL
492 *
493 * @var string
494 */
495 public $thisScript = '';
496
497 /**
498 * If set this is <td> CSS-classname for odd columns in addElement. Used with db_layout / pages section
499 *
500 * @var string
501 */
502 public $oddColumnsCssClass = '';
503
504 /**
505 * Not used in this class - but maybe extension classes...
506 * Max length of strings
507 *
508 * @var int
509 */
510 public $fixedL = 30;
511
512 /**
513 * @var TranslationConfigurationProvider
514 */
515 public $translateTools;
516
517 /**
518 * Keys are fieldnames and values are td-parameters to add in addElement(), please use $addElement_tdCSSClass for CSS-classes;
519 *
520 * @var array
521 */
522 public $addElement_tdParams = [];
523
524 /**
525 * @var int
526 */
527 public $no_noWrap = 0;
528
529 /**
530 * @var int
531 */
532 public $showIcon = 1;
533
534 /**
535 * Keys are fieldnames and values are td-css-classes to add in addElement();
536 *
537 * @var array
538 */
539 public $addElement_tdCssClass = [];
540
541 /**
542 * @var \TYPO3\CMS\Backend\Clipboard\Clipboard
543 */
544 protected $clipboard;
545
546 /**
547 * User permissions
548 *
549 * @var int
550 */
551 public $ext_CALC_PERMS;
552
553 /**
554 * Current ids page record
555 *
556 * @var array
557 */
558 protected $pageinfo;
559
560 /**
561 * Caches the available languages in a colPos
562 *
563 * @var array
564 */
565 protected $languagesInColumnCache = [];
566
567 /**
568 * Caches the amount of content elements as a matrix
569 *
570 * @var array
571 * @internal
572 */
573 protected $contentElementCache = [];
574
575 /**
576 * @var IconFactory
577 */
578 protected $iconFactory;
579
580 /**
581 * Stores whether a certain language has translations in it
582 *
583 * @var array
584 */
585 protected $languageHasTranslationsCache = [];
586
587 /**
588 * @var LocalizationController
589 */
590 protected $localizationController;
591
592 /**
593 * Override the page ids taken into account by getPageIdConstraint()
594 *
595 * @var array
596 */
597 protected $overridePageIdList = [];
598
599 /**
600 * Override/add urlparameters in listUrl() method
601 *
602 * @var string[]
603 */
604 protected $overrideUrlParameters = [];
605
606 /**
607 * Array with before/after setting for tables
608 * Structure:
609 * 'tableName' => [
610 * 'before' => ['A', ...]
611 * 'after' => []
612 * ]
613 * @var array[]
614 */
615 protected $tableDisplayOrder = [];
616
617 /**
618 * Construct to initialize class variables.
619 */
620 public function __construct()
621 {
622 if (isset($GLOBALS['BE_USER']->uc['titleLen']) && $GLOBALS['BE_USER']->uc['titleLen'] > 0) {
623 $this->fixedL = $GLOBALS['BE_USER']->uc['titleLen'];
624 }
625 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
626 $this->getTranslateTools();
627 $this->determineScriptUrl();
628 $this->localizationController = GeneralUtility::makeInstance(LocalizationController::class);
629 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
630 $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
631 $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_layout.xlf');
632 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
633 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Localization');
634 }
635
636 /*****************************************
637 *
638 * Renderings
639 *
640 *****************************************/
641 /**
642 * Adds the code of a single table
643 *
644 * @param string $table Table name
645 * @param int $id Current page id
646 * @param string $fields
647 * @return string HTML for listing.
648 */
649 public function getTable($table, $id, $fields = '')
650 {
651 if (isset($this->externalTables[$table])) {
652 return $this->getExternalTables($id, $table);
653 }
654 // Branch out based on table name:
655 switch ($table) {
656 case 'pages':
657 return $this->getTable_pages($id);
658 break;
659 case 'tt_content':
660 return $this->getTable_tt_content($id);
661 break;
662 default:
663 return '';
664 }
665 }
666
667 /**
668 * Renders an external table from page id
669 *
670 * @param int $id Page id
671 * @param string $table Name of the table
672 * @return string HTML for the listing
673 */
674 public function getExternalTables($id, $table)
675 {
676 $this->pageinfo = BackendUtility::readPageAccess($id, '');
677 $type = $this->getPageLayoutController()->MOD_SETTINGS[$table];
678 if (!isset($type)) {
679 $type = 0;
680 }
681 // eg. "name;title;email;company,image"
682 $fList = $this->externalTables[$table][$type]['fList'];
683 // The columns are separeted by comma ','.
684 // Values separated by semicolon ';' are shown in the same column.
685 $icon = $this->externalTables[$table][$type]['icon'];
686 $addWhere = $this->externalTables[$table][$type]['addWhere'];
687 // Create listing
688 $out = $this->makeOrdinaryList($table, $id, $fList, $icon, $addWhere);
689 return $out;
690 }
691
692 /**
693 * Renders records from the pages table from page id
694 * (Used to get information about the page tree content by "Web>Info"!)
695 *
696 * @param int $id Page id
697 * @return string HTML for the listing
698 */
699 public function getTable_pages($id)
700 {
701 // Initializing:
702 $out = '';
703 $lang = $this->getLanguageService();
704 // Select current page:
705 if (!$id) {
706 // The root has a pseudo record in pageinfo...
707 $row = $this->getPageLayoutController()->pageinfo;
708 } else {
709 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
710 ->getQueryBuilderForTable('pages');
711 $queryBuilder->getRestrictions()
712 ->removeAll()
713 ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
714 $row = $queryBuilder
715 ->select('*')
716 ->from('pages')
717 ->where(
718 $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
719 $this->getBackendUser()->getPagePermsClause(1)
720 )
721 ->execute()
722 ->fetch();
723 BackendUtility::workspaceOL('pages', $row);
724 }
725 // If there was found a page:
726 if (is_array($row)) {
727 // Getting select-depth:
728 $depth = (int)$this->getPageLayoutController()->MOD_SETTINGS['pages_levels'];
729 // Overriding a few things:
730 $this->no_noWrap = 0;
731 // Items
732 $this->eCounter = $this->firstElementNumber;
733 // Creating elements:
734 list($flag, $code) = $this->fwd_rwd_nav();
735 $out .= $code;
736 $editUids = [];
737 if ($flag) {
738 // Getting children:
739 $theRows = $this->getPageRecordsRecursive($row['uid'], $depth);
740 if ($this->getBackendUser()->doesUserHaveAccess($row, 2) && $row['uid'] > 0) {
741 $editUids[] = $row['uid'];
742 }
743 $out .= $this->pages_drawItem($row, $this->fieldArray);
744 // Traverse all pages selected:
745 foreach ($theRows as $sRow) {
746 if ($this->getBackendUser()->doesUserHaveAccess($sRow, 2)) {
747 $editUids[] = $sRow['uid'];
748 }
749 $out .= $this->pages_drawItem($sRow, $this->fieldArray);
750 }
751 $this->eCounter++;
752 }
753 // Header line is drawn
754 $theData = [];
755 $editIdList = implode(',', $editUids);
756 // Traverse fields (as set above) in order to create header values:
757 foreach ($this->fieldArray as $field) {
758 if ($editIdList
759 && isset($GLOBALS['TCA']['pages']['columns'][$field])
760 && $field !== 'uid'
761 && !$this->pages_noEditColumns
762 ) {
763 $iTitle = sprintf(
764 $lang->getLL('editThisColumn'),
765 rtrim(trim($lang->sL(BackendUtility::getItemLabel('pages', $field))), ':')
766 );
767 $urlParameters = [
768 'edit' => [
769 'pages' => [
770 $editIdList => 'edit'
771 ]
772 ],
773 'columnsOnly' => $field,
774 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
775 ];
776 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
777 $eI = '<a class="btn btn-default" href="' . htmlspecialchars($url)
778 . '" title="' . htmlspecialchars($iTitle) . '">'
779 . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
780 } else {
781 $eI = '';
782 }
783 switch ($field) {
784 case 'title':
785 $theData[$field] = '&nbsp;' . $eI . '<strong>'
786 . $lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label'])
787 . '</strong>';
788 break;
789 case 'uid':
790 $theData[$field] = '&nbsp;<strong>ID:</strong>';
791 break;
792 default:
793 if (substr($field, 0, 6) === 'table_') {
794 $f2 = substr($field, 6);
795 if ($GLOBALS['TCA'][$f2]) {
796 $theData[$field] = '&nbsp;' .
797 '<span title="' .
798 htmlspecialchars($lang->sL($GLOBALS['TCA'][$f2]['ctrl']['title'])) .
799 '">' .
800 $this->iconFactory->getIconForRecord($f2, [], Icon::SIZE_SMALL)->render() .
801 '</span>';
802 }
803 } else {
804 $theData[$field] = '&nbsp;&nbsp;' . $eI . '<strong>'
805 . htmlspecialchars($lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label']))
806 . '</strong>';
807 }
808 }
809 }
810 $out = '<div class="table-fit">'
811 . '<table class="table table-striped table-hover typo3-page-pages">'
812 . '<thead>'
813 . $this->addElement(1, '', $theData)
814 . '</thead>'
815 . '<tbody>'
816 . $out
817 . '</tbody>'
818 . '</table>'
819 . '</div>';
820 }
821 return $out;
822 }
823
824 /**
825 * Renders Content Elements from the tt_content table from page id
826 *
827 * @param int $id Page id
828 * @return string HTML for the listing
829 */
830 public function getTable_tt_content($id)
831 {
832 $backendUser = $this->getBackendUser();
833 $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
834 ->getConnectionForTable('tt_content')
835 ->getExpressionBuilder();
836 $this->pageinfo = BackendUtility::readPageAccess($this->id, '');
837 $this->initializeLanguages();
838 $this->initializeClipboard();
839 $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), true));
840 /** @var $pageRenderer PageRenderer */
841 $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
842 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/DragDrop');
843 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
844 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/Paste');
845 $userCanEditPage = $this->ext_CALC_PERMS & Permission::PAGE_EDIT && !empty($this->id) && ($backendUser->isAdmin() || (int)$this->pageinfo['editlock'] === 0);
846 if ($userCanEditPage) {
847 $languageOverlayId = 0;
848 $pageLocalizationRecord = BackendUtility::getRecordLocalization('pages', $this->id, (int)$this->tt_contentConfig['sys_language_uid']);
849 if (is_array($pageLocalizationRecord)) {
850 $pageLocalizationRecord = reset($pageLocalizationRecord);
851 }
852 if (!empty($pageLocalizationRecord['uid'])) {
853 $languageOverlayId = $pageLocalizationRecord['uid'];
854 }
855 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
856 PageActions.setPageId(' . (int)$this->id . ');
857 PageActions.setLanguageOverlayId(' . $languageOverlayId . ');
858 PageActions.initializePageTitleRenaming();
859 }');
860 }
861 // Get labels for CTypes and tt_content element fields in general:
862 $this->CType_labels = [];
863 foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
864 $this->CType_labels[$val[1]] = $this->getLanguageService()->sL($val[0]);
865 }
866 $this->itemLabels = [];
867 foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) {
868 $this->itemLabels[$name] = $this->getLanguageService()->sL($val['label']);
869 }
870 $languageColumn = [];
871 $out = '';
872
873 // Setting language list:
874 $langList = $this->tt_contentConfig['sys_language_uid'];
875 if ($this->tt_contentConfig['languageMode']) {
876 if ($this->tt_contentConfig['languageColsPointer']) {
877 $langList = '0,' . $this->tt_contentConfig['languageColsPointer'];
878 } else {
879 $langList = implode(',', array_keys($this->tt_contentConfig['languageCols']));
880 }
881 $languageColumn = [];
882 }
883 $langListArr = GeneralUtility::intExplode(',', $langList);
884 $defaultLanguageElementsByColumn = [];
885 $defLangBinding = [];
886 // For each languages... :
887 // If not languageMode, then we'll only be through this once.
888 foreach ($langListArr as $lP) {
889 $lP = (int)$lP;
890
891 if (!isset($this->contentElementCache[$lP])) {
892 $this->contentElementCache[$lP] = [];
893 }
894
895 if (count($langListArr) === 1 || $lP === 0) {
896 $showLanguage = $expressionBuilder->in('sys_language_uid', [$lP, -1]);
897 } else {
898 $showLanguage = $expressionBuilder->eq('sys_language_uid', $lP);
899 }
900 $content = [];
901 $head = [];
902
903 $backendLayout = $this->getBackendLayoutView()->getSelectedBackendLayout($this->id);
904 $columns = $backendLayout['__colPosList'];
905 // Select content records per column
906 $contentRecordsPerColumn = $this->getContentRecordsPerColumn('table', $id, $columns, $showLanguage);
907 $cList = array_keys($contentRecordsPerColumn);
908 // For each column, render the content into a variable:
909 foreach ($cList as $columnId) {
910 if (!isset($this->contentElementCache[$lP][$columnId])) {
911 $this->contentElementCache[$lP][$columnId] = [];
912 }
913
914 if (!$lP) {
915 $defaultLanguageElementsByColumn[$columnId] = [];
916 }
917 // Start wrapping div
918 $content[$columnId] .= '<div data-colpos="' . $columnId . '" data-language-uid="' . $lP . '" class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-' . $lP . ' t3-page-ce-wrapper';
919 if (empty($contentRecordsPerColumn[$columnId])) {
920 $content[$columnId] .= ' t3-page-ce-empty';
921 }
922 $content[$columnId] .= '">';
923 // Add new content at the top most position
924 $link = '';
925 if ($this->getPageLayoutController()->contentIsNotLockedForEditors()
926 && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
927 ) {
928 if ($this->option_newWizard) {
929 $urlParameters = [
930 'id' => $id,
931 'sys_language_uid' => $lP,
932 'colPos' => $columnId,
933 'uid_pid' => $id,
934 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
935 ];
936 $tsConfig = BackendUtility::getModTSconfig($id, 'mod');
937 $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
938 ? $tsConfig['properties']['newContentElementWizard.']['override']
939 : 'new_content_element_wizard';
940 $url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
941 } else {
942 $urlParameters = [
943 'edit' => [
944 'tt_content' => [
945 $id => 'new'
946 ]
947 ],
948 'defVals' => [
949 'tt_content' => [
950 'colPos' => $columnId,
951 'sys_language_uid' => $lP
952 ]
953 ],
954 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
955 ];
956 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
957 }
958 $title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
959 $link = '<a href="#" data-url="' . htmlspecialchars($url) . '" '
960 . 'title="' . $title . '"'
961 . 'data-title="' . $title . '"'
962 . 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
963 . $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render()
964 . ' '
965 . htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
966 }
967 if ($this->getBackendUser()->checkLanguageAccess($lP) && $columnId !== 'unused') {
968 $content[$columnId] .= '
969 <div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . StringUtility::getUniqueId() . '">
970 <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $columnId . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">'
971 . $link
972 . '</div>
973 <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
974 </div>
975 ';
976 }
977 $editUidList = '';
978 if (!isset($contentRecordsPerColumn[$columnId]) || !is_array($contentRecordsPerColumn[$columnId])) {
979 $message = GeneralUtility::makeInstance(
980 FlashMessage::class,
981 $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:error.invalidBackendLayout'),
982 '',
983 FlashMessage::WARNING
984 );
985 $service = GeneralUtility::makeInstance(FlashMessageService::class);
986 $queue = $service->getMessageQueueByIdentifier();
987 $queue->addMessage($message);
988 } else {
989 $rowArr = $contentRecordsPerColumn[$columnId];
990 $this->generateTtContentDataArray($rowArr);
991
992 foreach ((array)$rowArr as $rKey => $row) {
993 $this->contentElementCache[$lP][$columnId][$row['uid']] = $row;
994 if ($this->tt_contentConfig['languageMode']) {
995 $languageColumn[$columnId][$lP] = $head[$columnId] . $content[$columnId];
996 if (!$this->defLangBinding && $columnId !== 'unused') {
997 $languageColumn[$columnId][$lP] .= $this->newLanguageButton(
998 $this->getNonTranslatedTTcontentUids($defaultLanguageElementsByColumn[$columnId], $id, $lP),
999 $lP,
1000 $columnId
1001 );
1002 }
1003 }
1004 if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
1005 $singleElementHTML = '';
1006 if (!$lP && ($this->defLangBinding || $row['sys_language_uid'] != -1)) {
1007 $defaultLanguageElementsByColumn[$columnId][] = (isset($row['_ORIG_uid']) ? $row['_ORIG_uid'] : $row['uid']);
1008 }
1009 $editUidList .= $row['uid'] . ',';
1010 $disableMoveAndNewButtons = $this->defLangBinding && $lP > 0;
1011 if (!$this->tt_contentConfig['languageMode']) {
1012 $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility::getUniqueId() . '">';
1013 }
1014 $singleElementHTML .= $this->tt_content_drawHeader(
1015 $row,
1016 $this->tt_contentConfig['showInfo'] ? 15 : 5,
1017 $disableMoveAndNewButtons,
1018 true,
1019 $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)
1020 );
1021 $innerContent = '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>'
1022 . $this->tt_content_drawItem($row) . '</div>';
1023 $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>'
1024 . $this->tt_content_drawFooter($row);
1025 $isDisabled = $this->isDisabled('tt_content', $row);
1026 $statusHidden = $isDisabled ? ' t3-page-ce-hidden t3js-hidden-record' : '';
1027 $displayNone = !$this->tt_contentConfig['showHidden'] && $isDisabled ? ' style="display: none;"' : '';
1028 $highlightHeader = '';
1029 if ($this->checkIfTranslationsExistInLanguage([], (int)$row['sys_language_uid']) && (int)$row['l18n_parent'] === 0) {
1030 $highlightHeader = ' t3-page-ce-danger';
1031 } elseif ($columnId === 'unused') {
1032 $highlightHeader = ' t3-page-ce-warning';
1033 }
1034 $singleElementHTML = '<div class="t3-page-ce' . $highlightHeader . ' t3js-page-ce t3js-page-ce-sortable ' . $statusHidden . '" id="element-tt_content-'
1035 . $row['uid'] . '" data-table="tt_content" data-uid="' . $row['uid'] . '"' . $displayNone . '>' . $singleElementHTML . '</div>';
1036
1037 if ($this->tt_contentConfig['languageMode']) {
1038 $singleElementHTML .= '<div class="t3-page-ce t3js-page-ce">';
1039 }
1040 $singleElementHTML .= '<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $columnId . '-' . 'page-' . $id .
1041 '-' . StringUtility::getUniqueId() . '">';
1042 // Add icon "new content element below"
1043 if (!$disableMoveAndNewButtons
1044 && $this->getPageLayoutController()->contentIsNotLockedForEditors()
1045 && $this->getBackendUser()->checkLanguageAccess($lP)
1046 && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
1047 && $columnId !== 'unused'
1048 ) {
1049 // New content element:
1050 if ($this->option_newWizard) {
1051 $urlParameters = [
1052 'id' => $row['pid'],
1053 'sys_language_uid' => $row['sys_language_uid'],
1054 'colPos' => $row['colPos'],
1055 'uid_pid' => -$row['uid'],
1056 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1057 ];
1058 $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod');
1059 $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
1060 ? $tsConfig['properties']['newContentElementWizard.']['override']
1061 : 'new_content_element_wizard';
1062 $url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
1063 } else {
1064 $urlParameters = [
1065 'edit' => [
1066 'tt_content' => [
1067 -$row['uid'] => 'new'
1068 ]
1069 ],
1070 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1071 ];
1072 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1073 }
1074 $title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
1075 $singleElementHTML .= '<a href="#" data-url="' . htmlspecialchars($url) . '" '
1076 . 'title="' . $title . '"'
1077 . 'data-title="' . $title . '"'
1078 . 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
1079 . $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render()
1080 . ' '
1081 . htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
1082 }
1083 $singleElementHTML .= '</div></div><div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div></div>';
1084 if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
1085 $defLangBinding[$columnId][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML;
1086 } else {
1087 $content[$columnId] .= $singleElementHTML;
1088 }
1089 } else {
1090 unset($rowArr[$rKey]);
1091 }
1092 }
1093 $content[$columnId] .= '</div>';
1094 $colTitle = BackendUtility::getProcessedValue('tt_content', 'colPos', $columnId);
1095 $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $id, $this);
1096 foreach ($tcaItems as $item) {
1097 if ($item[1] == $columnId) {
1098 $colTitle = $this->getLanguageService()->sL($item[0]);
1099 }
1100 }
1101 if ($columnId === 'unused') {
1102 if (empty($unusedElementsMessage)) {
1103 $unusedElementsMessage = GeneralUtility::makeInstance(
1104 FlashMessage::class,
1105 $this->getLanguageService()->getLL('staleUnusedElementsWarning'),
1106 $this->getLanguageService()->getLL('staleUnusedElementsWarningTitle'),
1107 FlashMessage::WARNING
1108 );
1109 $service = GeneralUtility::makeInstance(FlashMessageService::class);
1110 $queue = $service->getMessageQueueByIdentifier();
1111 $queue->addMessage($unusedElementsMessage);
1112 }
1113 $colTitle = $this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:colPos.I.unused');
1114 $editParam = '';
1115 } else {
1116 $editParam = $this->doEdit && !empty($rowArr)
1117 ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc
1118 : '';
1119 }
1120 $head[$columnId] .= $this->tt_content_drawColHeader($colTitle, $editParam);
1121 }
1122 }
1123 // For each column, fit the rendered content into a table cell:
1124 $out = '';
1125 if ($this->tt_contentConfig['languageMode']) {
1126 // in language mode process the content elements, but only fill $languageColumn. output will be generated later
1127 $sortedLanguageColumn = [];
1128 foreach ($cList as $columnId) {
1129 if (GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnId) || $columnId === 'unused') {
1130 $languageColumn[$columnId][$lP] = $head[$columnId] . $content[$columnId];
1131 if (!$this->defLangBinding && $columnId !== 'unused') {
1132 $languageColumn[$columnId][$lP] .= $this->newLanguageButton(
1133 $this->getNonTranslatedTTcontentUids($defaultLanguageElementsByColumn[$columnId], $id, $lP),
1134 $lP,
1135 $columnId
1136 );
1137 }
1138 // We sort $languageColumn again according to $cList as it may contain data already from above.
1139 $sortedLanguageColumn[$columnId] = $languageColumn[$columnId];
1140 }
1141 }
1142 if (!empty($languageColumn['unused'])) {
1143 $sortedLanguageColumn['unused'] = $languageColumn['unused'];
1144 }
1145 $languageColumn = $sortedLanguageColumn;
1146 } else {
1147 // GRID VIEW:
1148 $grid = '<div class="t3-grid-container"><table border="0" cellspacing="0" cellpadding="0" width="100%" class="t3-page-columns t3-grid-table t3js-page-columns">';
1149 // Add colgroups
1150 $colCount = (int)$backendLayout['__config']['backend_layout.']['colCount'];
1151 $rowCount = (int)$backendLayout['__config']['backend_layout.']['rowCount'];
1152 $grid .= '<colgroup>';
1153 for ($i = 0; $i < $colCount; $i++) {
1154 $grid .= '<col />';
1155 }
1156 $grid .= '</colgroup>';
1157 // Cycle through rows
1158 for ($row = 1; $row <= $rowCount; $row++) {
1159 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
1160 if (!isset($rowConfig)) {
1161 continue;
1162 }
1163 $grid .= '<tr>';
1164 for ($col = 1; $col <= $colCount; $col++) {
1165 $columnConfig = $rowConfig['columns.'][$col . '.'];
1166 if (!isset($columnConfig)) {
1167 continue;
1168 }
1169 // Which tt_content colPos should be displayed inside this cell
1170 $columnKey = (int)$columnConfig['colPos'];
1171 // Render the grid cell
1172 $colSpan = (int)$columnConfig['colspan'];
1173 $rowSpan = (int)$columnConfig['rowspan'];
1174 $grid .= '<td valign="top"' .
1175 ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') .
1176 ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') .
1177 ' data-colpos="' . (int)$columnConfig['colPos'] . '" data-language-uid="' . $lP . '" class="t3js-page-lang-column-' . $lP . ' t3js-page-column t3-grid-cell t3-page-column t3-page-column-' . $columnKey .
1178 ((!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '') ? ' t3-grid-cell-unassigned' : '') .
1179 ((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ' t3-grid-cell-restricted' : '') .
1180 ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') .
1181 ($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">';
1182
1183 // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
1184 // If not, a new header without any buttons will be generated.
1185 if (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey]
1186 && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
1187 ) {
1188 $grid .= $head[$columnKey] . $content[$columnKey];
1189 } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
1190 && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
1191 ) {
1192 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'));
1193 } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
1194 && !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
1195 ) {
1196 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
1197 ' (' . $this->getLanguageService()->getLL('noAccess') . ')');
1198 } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
1199 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name'])
1200 . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')');
1201 } else {
1202 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('notAssigned'));
1203 }
1204
1205 $grid .= '</td>';
1206 }
1207 $grid .= '</tr>';
1208 }
1209 if (!empty($content['unused'])) {
1210 $grid .= '<tr>';
1211 // Which tt_content colPos should be displayed inside this cell
1212 $columnKey = 'unused';
1213 // Render the grid cell
1214 $colSpan = (int)$backendLayout['__config']['backend_layout.']['colCount'];
1215 $grid .= '<td valign="top"' .
1216 ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') .
1217 ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') .
1218 ' data-colpos="unused" data-language-uid="' . $lP . '" class="t3js-page-lang-column-' . $lP . ' t3js-page-column t3-grid-cell t3-page-column t3-page-column-' . $columnKey .
1219 ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') . '">';
1220
1221 // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
1222 // If not, a new header without any buttons will be generated.
1223 $grid .= $head[$columnKey] . $content[$columnKey];
1224 $grid .= '</td></tr>';
1225 }
1226 $out .= $grid . '</table></div>';
1227 }
1228 }
1229 $elFromTable = $this->clipboard->elFromTable('tt_content');
1230 if (!empty($elFromTable) && $this->getPageLayoutController()->pageIsNotLockedForEditors()) {
1231 $pasteItem = substr(key($elFromTable), 11);
1232 $pasteRecord = BackendUtility::getRecord('tt_content', (int)$pasteItem);
1233 $pasteTitle = $pasteRecord['header'] ? $pasteRecord['header'] : $pasteItem;
1234 $copyMode = $this->clipboard->clipData['normal']['mode'] ? '-' . $this->clipboard->clipData['normal']['mode'] : '';
1235 $addExtOnReadyCode = '
1236 top.pasteIntoLinkTemplate = '
1237 . $this->tt_content_drawPasteIcon($pasteItem, $pasteTitle, $copyMode, 't3js-paste-into', 'pasteIntoColumn')
1238 . ';
1239 top.pasteAfterLinkTemplate = '
1240 . $this->tt_content_drawPasteIcon($pasteItem, $pasteTitle, $copyMode, 't3js-paste-after', 'pasteAfterRecord')
1241 . ';';
1242 } else {
1243 $addExtOnReadyCode = '
1244 top.pasteIntoLinkTemplate = \'\';
1245 top.pasteAfterLinkTemplate = \'\';';
1246 }
1247 $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
1248 $pageRenderer->addJsInlineCode('pasteLinkTemplates', $addExtOnReadyCode);
1249 // If language mode, then make another presentation:
1250 // Notice that THIS presentation will override the value of $out!
1251 // But it needs the code above to execute since $languageColumn is filled with content we need!
1252 if ($this->tt_contentConfig['languageMode']) {
1253 // Get language selector:
1254 $languageSelector = $this->languageSelector($id);
1255 // Reset out - we will make new content here:
1256 $out = '';
1257 // Traverse languages found on the page and build up the table displaying them side by side:
1258 $cCont = [];
1259 $sCont = [];
1260 foreach ($langListArr as $lP) {
1261 // Header:
1262 $lP = (int)$lP;
1263 $cCont[$lP] = '
1264 <td valign="top" class="t3-page-column" data-language-uid="' . $lP . '">
1265 <h2>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</h2>
1266 </td>';
1267
1268 // "View page" icon is added:
1269 $viewLink = '';
1270 if (!VersionState::cast($this->getPageLayoutController()->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
1271 $onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id), '', '', ('&L=' . $lP));
1272 $viewLink = '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.showPage')) . '">' . $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>';
1273 }
1274 // Language overlay page header:
1275 if ($lP) {
1276 $pageLocalizationRecord = BackendUtility::getRecordLocalization('pages', $id, $lP);
1277 if (is_array($pageLocalizationRecord)) {
1278 $pageLocalizationRecord = reset($pageLocalizationRecord);
1279 }
1280 BackendUtility::workspaceOL('pages', $pageLocalizationRecord);
1281 $recordIcon = BackendUtility::wrapClickMenuOnIcon(
1282 $this->iconFactory->getIconForRecord('pages', $pageLocalizationRecord, Icon::SIZE_SMALL)->render(),
1283 'pages',
1284 $pageLocalizationRecord['uid']
1285 );
1286 $urlParameters = [
1287 'edit' => [
1288 'pages' => [
1289 $pageLocalizationRecord['uid'] => 'edit'
1290 ]
1291 ],
1292 'overrideVals' => [
1293 'pages' => [
1294 'sys_language_uid' => $lP
1295 ]
1296 ],
1297 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1298 ];
1299 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1300 $editLink = (
1301 $this->getBackendUser()->check('tables_modify', 'pages')
1302 ? '<a href="' . htmlspecialchars($url) . '" class="btn btn-default btn-sm"'
1303 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1304 . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>'
1305 : ''
1306 );
1307
1308 $lPLabel =
1309 '<div class="btn-group">'
1310 . $viewLink
1311 . $editLink
1312 . '</div>'
1313 . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($pageLocalizationRecord['title'], 20));
1314 } else {
1315 $editLink = '';
1316 $recordIcon = '';
1317 if ($this->getBackendUser()->checkLanguageAccess(0)) {
1318 $recordIcon = BackendUtility::wrapClickMenuOnIcon(
1319 $this->iconFactory->getIconForRecord('pages', $this->pageRecord, Icon::SIZE_SMALL)->render(),
1320 'pages',
1321 $this->id
1322 );
1323 $urlParameters = [
1324 'edit' => [
1325 'pages' => [
1326 $this->id => 'edit'
1327 ]
1328 ],
1329 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1330 ];
1331 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1332 $editLink = (
1333 $this->getBackendUser()->check('tables_modify', 'pages')
1334 ? '<a href="' . htmlspecialchars($url) . '" class="btn btn-default btn-sm"'
1335 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1336 . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>'
1337 : ''
1338 );
1339 }
1340
1341 $lPLabel =
1342 '<div class="btn-group">'
1343 . $viewLink
1344 . $editLink
1345 . '</div>'
1346 . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->pageRecord['title'], 20));
1347 }
1348 $sCont[$lP] = '
1349 <td class="t3-page-column t3-page-lang-label nowrap">' . $lPLabel . '</td>';
1350 }
1351 // Add headers:
1352 $out .= '<tr>' . implode($cCont) . '</tr>';
1353 $out .= '<tr>' . implode($sCont) . '</tr>';
1354 unset($cCont, $sCont);
1355
1356 // Traverse previously built content for the columns:
1357 foreach ($languageColumn as $cKey => $cCont) {
1358 $out .= '<tr>';
1359 foreach ($cCont as $languageId => $columnContent) {
1360 $out .= '<td valign="top" data-colpos="' . $cKey . '" class="t3-grid-cell t3-page-column t3js-page-column t3js-page-lang-column t3js-page-lang-column-' . $languageId . '">' . $columnContent . '</td>';
1361 }
1362 $out .= '</tr>';
1363 if ($this->defLangBinding) {
1364 // "defLangBinding" mode
1365 foreach ($defaultLanguageElementsByColumn[$cKey] as $defUid) {
1366 $cCont = [];
1367 foreach ($langListArr as $lP) {
1368 $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . $this->newLanguageButton(
1369 $this->getNonTranslatedTTcontentUids([$defUid], $id, $lP),
1370 $lP,
1371 $cKey
1372 );
1373 }
1374 $out .= '
1375 <tr>
1376 <td valign="top" class="t3-grid-cell">' . implode(('</td>' . '
1377 <td valign="top" class="t3-grid-cell">'), $cCont) . '</td>
1378 </tr>';
1379 }
1380 }
1381 }
1382 // Finally, wrap it all in a table and add the language selector on top of it:
1383 $out = $languageSelector . '
1384 <div class="t3-grid-container">
1385 <table cellpadding="0" cellspacing="0" class="t3-page-columns t3-grid-table t3js-page-columns">
1386 ' . $out . '
1387 </table>
1388 </div>';
1389 }
1390
1391 return $out;
1392 }
1393
1394 /**********************************
1395 *
1396 * Generic listing of items
1397 *
1398 **********************************/
1399 /**
1400 * Creates a standard list of elements from a table.
1401 *
1402 * @param string $table Table name
1403 * @param int $id Page id.
1404 * @param string $fList Comma list of fields to display
1405 * @param bool $icon If TRUE, icon is shown
1406 * @param string $addWhere Additional WHERE-clauses.
1407 * @return string HTML table
1408 */
1409 public function makeOrdinaryList($table, $id, $fList, $icon = false, $addWhere = '')
1410 {
1411 // Initialize
1412 $addWhere = empty($addWhere) ? [] : [QueryHelper::stripLogicalOperatorPrefix($addWhere)];
1413 $queryBuilder = $this->getQueryBuilder($table, $id, $addWhere);
1414 $this->setTotalItems($table, $id, $addWhere);
1415 $dbCount = 0;
1416 $result = false;
1417 // Make query for records if there were any records found in the count operation
1418 if ($this->totalItems) {
1419 $result = $queryBuilder->execute();
1420 // Will return FALSE, if $result is invalid
1421 $dbCount = $result->rowCount();
1422 }
1423 // If records were found, render the list
1424 if (!$dbCount) {
1425 return '';
1426 }
1427 // Set fields
1428 $out = '';
1429 $this->fieldArray = GeneralUtility::trimExplode(',', '__cmds__,' . $fList . ',__editIconLink__', true);
1430 $theData = [];
1431 $theData = $this->headerFields($this->fieldArray, $table, $theData);
1432 // Title row
1433 $localizedTableTitle = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title']));
1434 $out .= '<tr><th class="col-icon"></th>'
1435 . '<th colspan="' . (count($theData) - 2) . '"><span class="c-table">'
1436 . $localizedTableTitle . '</span> (' . $dbCount . ')</td>' . '<td class="col-icon"></td>'
1437 . '</tr>';
1438 // Column's titles
1439 if ($this->doEdit) {
1440 $urlParameters = [
1441 'edit' => [
1442 $table => [
1443 $this->id => 'new'
1444 ]
1445 ],
1446 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1447 ];
1448 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1449 $title = htmlspecialchars($this->getLanguageService()->getLL('new'));
1450 $theData['__cmds__'] = '<a href="#" data-url="' . htmlspecialchars($url) . '" class="t3js-toggle-new-content-element-wizard" '
1451 . 'title="' . $title . '"'
1452 . 'data-title="' . $title . '">'
1453 . $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render() . '</a>';
1454 }
1455 $out .= $this->addElement(1, '', $theData, ' class="c-headLine"', 15, '', 'th');
1456 // Render Items
1457 $this->eCounter = $this->firstElementNumber;
1458 while ($row = $result->fetch()) {
1459 BackendUtility::workspaceOL($table, $row);
1460 if (is_array($row)) {
1461 list($flag, $code) = $this->fwd_rwd_nav();
1462 $out .= $code;
1463 if ($flag) {
1464 $Nrow = [];
1465 // Setting icons links
1466 if ($icon) {
1467 $Nrow['__cmds__'] = $this->getIcon($table, $row);
1468 }
1469 // Get values:
1470 $Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow);
1471 // Attach edit icon
1472 if ($this->doEdit && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
1473 $urlParameters = [
1474 'edit' => [
1475 $table => [
1476 $row['uid'] => 'edit'
1477 ]
1478 ],
1479 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1480 ];
1481 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1482 $Nrow['__editIconLink__'] = '<a class="btn btn-default" href="' . htmlspecialchars($url)
1483 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1484 . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>';
1485 } else {
1486 $Nrow['__editIconLink__'] = $this->noEditIcon();
1487 }
1488 $out .= $this->addElement(1, '', $Nrow);
1489 }
1490 $this->eCounter++;
1491 }
1492 }
1493 // Wrap it all in a table:
1494 $out = '
1495 <!--
1496 Standard list of table "' . $table . '"
1497 -->
1498 <div class="table-fit"><table class="table table-hover table-striped">
1499 ' . $out . '
1500 </table></div>';
1501 return $out;
1502 }
1503
1504 /**
1505 * Adds content to all data fields in $out array
1506 *
1507 * Each field name in $fieldArr has a special feature which is that the field name can be specified as more field names.
1508 * Eg. "field1,field2;field3".
1509 * Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.
1510 *
1511 * @param array $fieldArr Array of fields to display
1512 * @param string $table Table name
1513 * @param array $row Record array
1514 * @param array $out Array to which the data is added
1515 * @return array $out array returned after processing.
1516 * @see makeOrdinaryList()
1517 */
1518 public function dataFields($fieldArr, $table, $row, $out = [])
1519 {
1520 // Check table validity
1521 if (!isset($GLOBALS['TCA'][$table])) {
1522 return $out;
1523 }
1524
1525 $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
1526 // Traverse fields
1527 foreach ($fieldArr as $fieldName) {
1528 if ($GLOBALS['TCA'][$table]['columns'][$fieldName]) {
1529 // Each field has its own cell (if configured in TCA)
1530 // If the column is a thumbnail column:
1531 if ($fieldName == $thumbsCol) {
1532 $out[$fieldName] = $this->thumbCode($row, $table, $fieldName);
1533 } else {
1534 // ... otherwise just render the output:
1535 $out[$fieldName] = nl2br(htmlspecialchars(trim(GeneralUtility::fixed_lgd_cs(
1536 BackendUtility::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']),
1537 250
1538 ))));
1539 }
1540 } else {
1541 // Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode
1542 // the field name with ";" and check each value there as a TCA configured field)
1543 $theFields = explode(';', $fieldName);
1544 // Traverse fields, separated by ";" (displayed in a single cell).
1545 foreach ($theFields as $fName2) {
1546 if ($GLOBALS['TCA'][$table]['columns'][$fName2]) {
1547 $out[$fieldName] .= '<strong>' . htmlspecialchars($this->getLanguageService()->sL(
1548 $GLOBALS['TCA'][$table]['columns'][$fName2]['label']
1549 )) . '</strong>' . '&nbsp;&nbsp;' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(
1550 BackendUtility::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']),
1551 25
1552 )) . '<br />';
1553 }
1554 }
1555 }
1556 // If no value, add a nbsp.
1557 if (!$out[$fieldName]) {
1558 $out[$fieldName] = '&nbsp;';
1559 }
1560 // Wrap in dimmed-span tags if record is "disabled"
1561 if ($this->isDisabled($table, $row)) {
1562 $out[$fieldName] = '<span class="text-muted">' . $out[$fieldName] . '</span>';
1563 }
1564 }
1565 return $out;
1566 }
1567
1568 /**
1569 * Header fields made for the listing of records
1570 *
1571 * @param array $fieldArr Field names
1572 * @param string $table The table name
1573 * @param array $out Array to which the headers are added.
1574 * @return array $out returned after addition of the header fields.
1575 * @see makeOrdinaryList()
1576 */
1577 public function headerFields($fieldArr, $table, $out = [])
1578 {
1579 foreach ($fieldArr as $fieldName) {
1580 $ll = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['columns'][$fieldName]['label']));
1581 $out[$fieldName] = $ll ? $ll : '&nbsp;';
1582 }
1583 return $out;
1584 }
1585
1586 /**
1587 * Gets content records per column.
1588 * This is required for correct workspace overlays.
1589 *
1590 * @param string $table UNUSED (will always be queried from tt_content)
1591 * @param int $id Page Id to be used (not used at all, but part of the API, see $this->pidSelect)
1592 * @param array $columns colPos values to be considered to be shown
1593 * @param string $additionalWhereClause Additional where clause for database select
1594 * @return array Associative array for each column (colPos)
1595 */
1596 protected function getContentRecordsPerColumn($table, $id, array $columns, $additionalWhereClause = '')
1597 {
1598 $contentRecordsPerColumn = array_fill_keys($columns, []);
1599 $columns = array_flip($columns);
1600 $queryBuilder = $this->getQueryBuilder(
1601 'tt_content',
1602 $id,
1603 [
1604 $additionalWhereClause
1605 ]
1606 );
1607
1608 // Traverse any selected elements and render their display code:
1609 $results = $this->getResult($queryBuilder->execute());
1610 $unused = [];
1611 $hookArray = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] ?? [];
1612 foreach ($results as $record) {
1613 $used = isset($columns[$record['colPos']]);
1614 foreach ($hookArray as $_funcRef) {
1615 $_params = ['columns' => $columns, 'record' => $record, 'used' => $used];
1616 $used = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1617 }
1618 if ($used) {
1619 $columnValue = (string)$record['colPos'];
1620 $contentRecordsPerColumn[$columnValue][] = $record;
1621 } else {
1622 $unused[] = $record;
1623 }
1624 }
1625 if (!empty($unused)) {
1626 $contentRecordsPerColumn['unused'] = $unused;
1627 }
1628 return $contentRecordsPerColumn;
1629 }
1630
1631 /**********************************
1632 *
1633 * Additional functions; Pages
1634 *
1635 **********************************/
1636
1637 /**
1638 * Adds pages-rows to an array, selecting recursively in the page tree.
1639 *
1640 * @param int $pid Starting page id to select from
1641 * @param string $iconPrefix Prefix for icon code.
1642 * @param int $depth Depth (decreasing)
1643 * @param array $rows Array which will accumulate page rows
1644 * @return array $rows with added rows.
1645 */
1646 protected function getPageRecordsRecursive(int $pid, int $depth, string $iconPrefix = '', array $rows = []): array
1647 {
1648 $depth--;
1649 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
1650 $queryBuilder->getRestrictions()
1651 ->removeAll()
1652 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
1653 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
1654
1655 $queryBuilder
1656 ->select('*')
1657 ->from('pages')
1658 ->where(
1659 $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)),
1660 $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
1661 $this->getBackendUser()->getPagePermsClause(1)
1662 );
1663
1664 if (!empty($GLOBALS['TCA']['pages']['ctrl']['sortby'])) {
1665 $queryBuilder->orderBy($GLOBALS['TCA']['pages']['ctrl']['sortby']);
1666 }
1667
1668 if ($depth >= 0) {
1669 $result = $queryBuilder->execute();
1670 $rowCount = $result->rowCount();
1671 $count = 0;
1672 while ($row = $result->fetch()) {
1673 BackendUtility::workspaceOL('pages', $row);
1674 if (is_array($row)) {
1675 $count++;
1676 $row['treeIcons'] = $iconPrefix
1677 . '<span class="treeline-icon treeline-icon-join'
1678 . ($rowCount === $count ? 'bottom' : '')
1679 . '"></span>';
1680 $rows[] = $row;
1681 // Get the branch
1682 $spaceOutIcons = '<span class="treeline-icon treeline-icon-'
1683 . ($rowCount === $count ? 'clear' : 'line')
1684 . '"></span>';
1685 $rows = $this->getPageRecordsRecursive(
1686 $row['uid'],
1687 $row['php_tree_stop'] ? 0 : $depth,
1688 $iconPrefix . $spaceOutIcons,
1689 $rows
1690 );
1691 }
1692 }
1693 }
1694
1695 return $rows;
1696 }
1697
1698 /**
1699 * Adds a list item for the pages-rendering
1700 *
1701 * @param array $row Record array
1702 * @param array $fieldArr Field list
1703 * @return string HTML for the item
1704 */
1705 public function pages_drawItem($row, $fieldArr)
1706 {
1707 // Initialization
1708 $theIcon = $this->getIcon('pages', $row);
1709 // Preparing and getting the data-array
1710 $theData = [];
1711 foreach ($fieldArr as $field) {
1712 switch ($field) {
1713 case 'title':
1714 $pTitle = htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field], 20));
1715 $theData[$field] = $row['treeIcons'] . $theIcon . $pTitle . '&nbsp;&nbsp;';
1716 break;
1717 case 'php_tree_stop':
1718 // Intended fall through
1719 case 'TSconfig':
1720 $theData[$field] = $row[$field] ? '&nbsp;<strong>x</strong>' : '&nbsp;';
1721 break;
1722 case 'uid':
1723 if ($this->getBackendUser()->doesUserHaveAccess($row, 2) && $row['uid'] > 0) {
1724 $urlParameters = [
1725 'edit' => [
1726 'pages' => [
1727 $row['uid'] => 'edit'
1728 ]
1729 ],
1730 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1731 ];
1732 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1733 $eI = '<a class="btn btn-default" href="' . htmlspecialchars($url)
1734 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('editThisPage')) . '">'
1735 . $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>';
1736 } else {
1737 $eI = '';
1738 }
1739 $theData[$field] = $eI . '<span align="right">' . $row['uid'] . '</span>';
1740 break;
1741 case 'shortcut':
1742 case 'shortcut_mode':
1743 if ((int)$row['doktype'] === \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT) {
1744 $theData[$field] = $this->getPagesTableFieldValue($field, $row);
1745 }
1746 break;
1747 default:
1748 if (substr($field, 0, 6) === 'table_') {
1749 $f2 = substr($field, 6);
1750 if ($GLOBALS['TCA'][$f2]) {
1751 $c = $this->numberOfRecords($f2, $row['uid']);
1752 $theData[$field] = '&nbsp;&nbsp;' . ($c ? $c : '');
1753 }
1754 } else {
1755 $theData[$field] = $this->getPagesTableFieldValue($field, $row);
1756 }
1757 }
1758 }
1759 $this->addElement_tdParams['title'] = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : '';
1760 return $this->addElement(1, '', $theData);
1761 }
1762
1763 /**
1764 * Returns the HTML code for rendering a field in the pages table.
1765 * The row value is processed to a human readable form and the result is parsed through htmlspecialchars().
1766 *
1767 * @param string $field The name of the field of which the value should be rendered.
1768 * @param array $row The pages table row as an associative array.
1769 * @return string The rendered table field value.
1770 */
1771 protected function getPagesTableFieldValue($field, array $row)
1772 {
1773 return '&nbsp;&nbsp;' . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
1774 }
1775
1776 /**********************************
1777 *
1778 * Additional functions; Content Elements
1779 *
1780 **********************************/
1781 /**
1782 * Draw header for a content element column:
1783 *
1784 * @param string $colName Column name
1785 * @param string $editParams Edit params (Syntax: &edit[...] for FormEngine)
1786 * @return string HTML table
1787 */
1788 public function tt_content_drawColHeader($colName, $editParams = '')
1789 {
1790 $iconsArr = [];
1791 // Create command links:
1792 if ($this->tt_contentConfig['showCommands']) {
1793 // Edit whole of column:
1794 if ($editParams && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT) && $this->getBackendUser()->checkLanguageAccess(0)) {
1795 $iconsArr['edit'] = '<a href="#" onclick="'
1796 . htmlspecialchars(BackendUtility::editOnClick($editParams)) . '" title="'
1797 . htmlspecialchars($this->getLanguageService()->getLL('editColumn')) . '">'
1798 . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
1799 }
1800 }
1801 $icons = '';
1802 if (!empty($iconsArr)) {
1803 $icons = '<div class="t3-page-column-header-icons">' . implode('', $iconsArr) . '</div>';
1804 }
1805 // Create header row:
1806 $out = '<div class="t3-page-column-header">
1807 ' . $icons . '
1808 <div class="t3-page-column-header-label">' . htmlspecialchars($colName) . '</div>
1809 </div>';
1810 return $out;
1811 }
1812
1813 /**
1814 * Draw a paste icon either for pasting into a column or for pasting after a record
1815 *
1816 * @param int $pasteItem ID of the item in the clipboard
1817 * @param string $pasteTitle Title for the JS modal
1818 * @param string $copyMode copy or cut
1819 * @param string $cssClass CSS class to determine if pasting is done into column or after record
1820 * @param string $title title attribute of the generated link
1821 *
1822 * @return string Generated HTML code with link and icon
1823 */
1824 protected function tt_content_drawPasteIcon($pasteItem, $pasteTitle, $copyMode, $cssClass, $title)
1825 {
1826 $pasteIcon = json_encode(
1827 ' <a data-content="' . htmlspecialchars($pasteItem) . '"'
1828 . ' data-title="' . htmlspecialchars($pasteTitle) . '"'
1829 . ' class="t3js-paste t3js-paste' . htmlspecialchars($copyMode) . ' ' . htmlspecialchars($cssClass) . ' btn btn-default btn-sm"'
1830 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL($title)) . '">'
1831 . $this->iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render()
1832 . '</a>'
1833 );
1834 return $pasteIcon;
1835 }
1836
1837 /**
1838 * Draw the footer for a single tt_content element
1839 *
1840 * @param array $row Record array
1841 * @return string HTML of the footer
1842 * @throws \UnexpectedValueException
1843 */
1844 protected function tt_content_drawFooter(array $row)
1845 {
1846 $content = '';
1847 // Get processed values:
1848 $info = [];
1849 $this->getProcessedValue('tt_content', 'starttime,endtime,fe_group,space_before_class,space_after_class', $row, $info);
1850
1851 // Content element annotation
1852 if (!empty($GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn'])) {
1853 $info[] = htmlspecialchars($row[$GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']]);
1854 }
1855
1856 // Call drawFooter hooks
1857 $drawFooterHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'];
1858 if (is_array($drawFooterHooks)) {
1859 foreach ($drawFooterHooks as $className) {
1860 $hookObject = GeneralUtility::makeInstance($className);
1861 if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface) {
1862 throw new \UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class, 1404378171);
1863 }
1864 $hookObject->preProcess($this, $info, $row);
1865 }
1866 }
1867
1868 // Display info from records fields:
1869 if (!empty($info)) {
1870 $content = '<div class="t3-page-ce-info">
1871 ' . implode('<br>', $info) . '
1872 </div>';
1873 }
1874 // Wrap it
1875 if (!empty($content)) {
1876 $content = '<div class="t3-page-ce-footer">' . $content . '</div>';
1877 }
1878 return $content;
1879 }
1880
1881 /**
1882 * Draw the header for a single tt_content element
1883 *
1884 * @param array $row Record array
1885 * @param int $space Amount of pixel space above the header. UNUSED
1886 * @param bool $disableMoveAndNewButtons If set the buttons for creating new elements and moving up and down are not shown.
1887 * @param bool $langMode If set, we are in language mode and flags will be shown for languages
1888 * @param bool $dragDropEnabled If set the move button must be hidden
1889 * @return string HTML table with the record header.
1890 */
1891 public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = false, $langMode = false, $dragDropEnabled = false)
1892 {
1893 $out = '';
1894 // If show info is set...;
1895 if ($this->tt_contentConfig['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
1896 // Render control panel for the element:
1897 if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
1898 // Edit content element:
1899 $urlParameters = [
1900 'edit' => [
1901 'tt_content' => [
1902 $this->tt_contentData['nextThree'][$row['uid']] => 'edit'
1903 ]
1904 ],
1905 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'],
1906 ];
1907 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters) . '#element-tt_content-' . $row['uid'];
1908
1909 $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url)
1910 . '" title="' . htmlspecialchars($this->nextThree > 1
1911 ? sprintf($this->getLanguageService()->getLL('nextThree'), $this->nextThree)
1912 : $this->getLanguageService()->getLL('edit'))
1913 . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>';
1914 // Hide element:
1915 $hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
1916 if ($hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField]
1917 && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude']
1918 || $this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))
1919 ) {
1920 if ($row[$hiddenField]) {
1921 $value = 0;
1922 $label = 'unHide';
1923 } else {
1924 $value = 1;
1925 $label = 'hide';
1926 }
1927 $params = '&data[tt_content][' . ($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid'])
1928 . '][' . $hiddenField . ']=' . $value;
1929 $out .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
1930 . '#element-tt_content-' . $row['uid'] . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($label)) . '">'
1931 . $this->iconFactory->getIcon('actions-edit-' . strtolower($label), Icon::SIZE_SMALL)->render() . '</a>';
1932 }
1933 // Delete
1934 $disableDeleteTS = $this->getBackendUser()->getTSConfig('options.disableDelete');
1935 $disableDelete = (bool) trim(isset($disableDeleteTS['properties']['tt_content']) ? $disableDeleteTS['properties']['tt_content'] : $disableDeleteTS['value']);
1936 if (!$disableDelete) {
1937 $params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
1938 $confirm = $this->getLanguageService()->getLL('deleteWarning')
1939 . BackendUtility::translationCount('tt_content', $row['uid'], (' '
1940 . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.translationsOfRecord')));
1941 $out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '"'
1942 . ' data-severity="warning"'
1943 . ' data-title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"'
1944 . ' data-content="' . htmlspecialchars($confirm) . '" '
1945 . ' data-button-close-text="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')) . '"'
1946 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('deleteItem')) . '">'
1947 . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
1948 if ($out && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
1949 $out = '<div class="btn-group btn-group-sm" role="group">' . $out . '</div>';
1950 } else {
1951 $out = '';
1952 }
1953 }
1954 if (!$disableMoveAndNewButtons) {
1955 $moveButtonContent = '';
1956 $displayMoveButtons = false;
1957 // Move element up:
1958 if ($this->tt_contentData['prev'][$row['uid']]) {
1959 $params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData['prev'][$row['uid']];
1960 $moveButtonContent .= '<a class="btn btn-default" href="'
1961 . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
1962 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveUp')) . '">'
1963 . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>';
1964 if (!$dragDropEnabled) {
1965 $displayMoveButtons = true;
1966 }
1967 } else {
1968 $moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
1969 }
1970 // Move element down:
1971 if ($this->tt_contentData['next'][$row['uid']]) {
1972 $params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData['next'][$row['uid']];
1973 $moveButtonContent .= '<a class="btn btn-default" href="'
1974 . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
1975 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveDown')) . '">'
1976 . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
1977 if (!$dragDropEnabled) {
1978 $displayMoveButtons = true;
1979 }
1980 } else {
1981 $moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
1982 }
1983 if ($displayMoveButtons) {
1984 $out .= '<div class="btn-group btn-group-sm" role="group">' . $moveButtonContent . '</div>';
1985 }
1986 }
1987 }
1988 }
1989 $allowDragAndDrop = $this->isDragAndDropAllowed($row);
1990 $additionalIcons = [];
1991 if ($row['sys_language_uid'] > 0 && $this->checkIfTranslationsExistInLanguage([], (int)$row['sys_language_uid'])) {
1992 $allowDragAndDrop = false;
1993 }
1994 $additionalIcons[] = $this->getIcon('tt_content', $row) . ' ';
1995 $additionalIcons[] = $langMode ? $this->languageFlag($row['sys_language_uid'], false) : '';
1996 // Get record locking status:
1997 if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
1998 $additionalIcons[] = '<a href="#" data-toggle="tooltip" data-title="' . htmlspecialchars($lockInfo['msg']) . '">'
1999 . $this->iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</a>';
2000 }
2001 // Call stats information hook
2002 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
2003 $_params = ['tt_content', $row['uid'], &$row];
2004 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
2005 $additionalIcons[] = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2006 }
2007 }
2008 // Wrap the whole header
2009 // NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
2010 return '<div class="t3-page-ce-header ' . ($allowDragAndDrop ? 't3-page-ce-header-draggable t3js-page-ce-draghandle' : '') . '">
2011 <div class="t3-page-ce-header-icons-left">' . implode('', $additionalIcons) . '</div>
2012 <div class="t3-page-ce-header-icons-right">' . ($out ? '<div class="btn-toolbar">' . $out . '</div>' : '') . '</div>
2013 </div>
2014 <div class="t3-page-ce-body">';
2015 }
2016
2017 /**
2018 * Determine whether Drag & Drop should be allowed
2019 *
2020 * @param array $row
2021 * @return bool
2022 */
2023 protected function isDragAndDropAllowed(array $row)
2024 {
2025 if ($this->getBackendUser()->isAdmin()
2026 || ((int)$row['editlock'] === 0 && (int)$this->pageinfo['editlock'] === 0)
2027 && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)
2028 && $this->getBackendUser()->checkAuthMode('tt_content', 'CType', $row['CType'], $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode'])
2029 ) {
2030 return true;
2031 }
2032 return false;
2033 }
2034
2035 /**
2036 * Draws the preview content for a content element
2037 *
2038 * @param array $row Content element
2039 * @return string HTML
2040 * @throws \UnexpectedValueException
2041 */
2042 public function tt_content_drawItem($row)
2043 {
2044 $out = '';
2045 $outHeader = '';
2046 // Make header:
2047
2048 if ($row['header']) {
2049 $infoArr = [];
2050 $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
2051 $hiddenHeaderNote = '';
2052 // If header layout is set to 'hidden', display an accordant note:
2053 if ($row['header_layout'] == 100) {
2054 $hiddenHeaderNote = ' <em>[' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.hidden')) . ']</em>';
2055 }
2056 $outHeader = $row['date']
2057 ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />'
2058 : '';
2059 $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row)
2060 . $hiddenHeaderNote . '</strong><br />';
2061 }
2062 // Make content:
2063 $infoArr = [];
2064 $drawItem = true;
2065 // Hook: Render an own preview of a record
2066 $drawItemHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
2067 if (is_array($drawItemHooks)) {
2068 foreach ($drawItemHooks as $className) {
2069 $hookObject = GeneralUtility::makeInstance($className);
2070 if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
2071 throw new \UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawItemHookInterface::class, 1218547409);
2072 }
2073 $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
2074 }
2075 }
2076
2077 // If the previous hook did not render something,
2078 // then check if a Fluid-based preview template was defined for this CType
2079 // and render it via Fluid. Possible option:
2080 // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html
2081 if ($drawItem) {
2082 $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview');
2083 $fluidTemplateFile = '';
2084
2085 if (
2086 $row['CType'] === 'list' && !empty($row['list_type'])
2087 && !empty($tsConfig['properties']['list.'][$row['list_type']])
2088 ) {
2089 $fluidTemplateFile = $tsConfig['properties']['list.'][$row['list_type']];
2090 } elseif (!empty($tsConfig['properties'][$row['CType']])) {
2091 $fluidTemplateFile = $tsConfig['properties'][$row['CType']];
2092 }
2093
2094 if ($fluidTemplateFile) {
2095 $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile);
2096 if ($fluidTemplateFile) {
2097 try {
2098 /** @var StandaloneView $view */
2099 $view = GeneralUtility::makeInstance(StandaloneView::class);
2100 $view->setTemplatePathAndFilename($fluidTemplateFile);
2101 $view->assignMultiple($row);
2102 if (!empty($row['pi_flexform'])) {
2103 /** @var FlexFormService $flexFormService */
2104 $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
2105 $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));
2106 }
2107 $out = $view->render();
2108 $drawItem = false;
2109 } catch (\Exception $e) {
2110 // Catch any exception to avoid breaking the view
2111 }
2112 }
2113 }
2114 }
2115
2116 // Draw preview of the item depending on its CType (if not disabled by previous hook):
2117 if ($drawItem) {
2118 switch ($row['CType']) {
2119 case 'header':
2120 if ($row['subheader']) {
2121 $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
2122 }
2123 break;
2124 case 'bullets':
2125 case 'table':
2126 if ($row['bodytext']) {
2127 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
2128 }
2129 break;
2130 case 'uploads':
2131 if ($row['media']) {
2132 $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
2133 }
2134 break;
2135 case 'menu':
2136 $contentType = $this->CType_labels[$row['CType']];
2137 $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
2138 // Add Menu Type
2139 $menuTypeLabel = $this->getLanguageService()->sL(
2140 BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type'])
2141 );
2142 $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';
2143 $out .= $this->linkEditContent($menuTypeLabel, $row);
2144 if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {
2145 // Show pages if menu type is not "Sitemap"
2146 $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
2147 }
2148 break;
2149 case 'shortcut':
2150 if (!empty($row['records'])) {
2151 $shortcutContent = [];
2152 $recordList = explode(',', $row['records']);
2153 foreach ($recordList as $recordIdentifier) {
2154 $split = BackendUtility::splitTable_Uid($recordIdentifier);
2155 $tableName = empty($split[0]) ? 'tt_content' : $split[0];
2156 $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);
2157 if (is_array($shortcutRecord)) {
2158 $icon = $this->iconFactory->getIconForRecord($tableName, $shortcutRecord, Icon::SIZE_SMALL)->render();
2159 $icon = BackendUtility::wrapClickMenuOnIcon(
2160 $icon,
2161 $tableName,
2162 $shortcutRecord['uid']
2163 );
2164 $shortcutContent[] = $icon
2165 . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));
2166 }
2167 }
2168 $out .= implode('<br />', $shortcutContent) . '<br />';
2169 }
2170 break;
2171 case 'list':
2172 $hookArr = [];
2173 $hookOut = '';
2174 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) {
2175 $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']];
2176 } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) {
2177 $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'];
2178 }
2179 if (!empty($hookArr)) {
2180 $_params = ['pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr];
2181 foreach ($hookArr as $_funcRef) {
2182 $hookOut .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2183 }
2184 }
2185 if ((string)$hookOut !== '') {
2186 $out .= $hookOut;
2187 } elseif (!empty($row['list_type'])) {
2188 $label = BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'list_type', $row['list_type']);
2189 if (!empty($label)) {
2190 $out .= $this->linkEditContent('<strong>' . htmlspecialchars($this->getLanguageService()->sL($label)) . '</strong>', $row) . '<br />';
2191 } else {
2192 $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
2193 $out .= '<span class="label label-warning">' . htmlspecialchars($message) . '</span>';
2194 }
2195 } else {
2196 $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
2197 }
2198 $out .= htmlspecialchars($this->getLanguageService()->sL(
2199 BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages'])
2200 )) . '<br />';
2201 break;
2202 default:
2203 $contentType = $this->CType_labels[$row['CType']];
2204
2205 if (isset($contentType)) {
2206 $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
2207 if ($row['bodytext']) {
2208 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
2209 }
2210 if ($row['image']) {
2211 $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row) . '<br />';
2212 }
2213 } else {
2214 $message = sprintf(
2215 $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'),
2216 $row['CType']
2217 );
2218 $out .= '<span class="label label-warning">' . htmlspecialchars($message) . '</span>';
2219 }
2220 }
2221 }
2222 // Wrap span-tags:
2223 $out = '
2224 <span class="exampleContent">' . $out . '</span>';
2225 // Add header:
2226 $out = $outHeader . $out;
2227 // Return values:
2228 if ($this->isDisabled('tt_content', $row)) {
2229 return '<span class="text-muted">' . $out . '</span>';
2230 }
2231 return $out;
2232 }
2233
2234 /**
2235 * Generates a list of selected pages or categories for the CType menu
2236 *
2237 * @param array $row row from pages
2238 * @return string
2239 */
2240 protected function generateListForCTypeMenu(array $row)
2241 {
2242 $table = 'pages';
2243 $field = 'pages';
2244 // get categories instead of pages
2245 if (strpos($row['menu_type'], 'categorized_') !== false) {
2246 $table = 'sys_category';
2247 $field = 'selected_categories';
2248 }
2249 if (trim($row[$field]) === '') {
2250 return '';
2251 }
2252 $content = '';
2253 $uidList = explode(',', $row[$field]);
2254 foreach ($uidList as $uid) {
2255 $uid = (int)$uid;
2256 $record = BackendUtility::getRecord($table, $uid, 'title');
2257 $content .= '<br>' . $record['title'] . ' (' . $uid . ')';
2258 }
2259 return $content;
2260 }
2261
2262 /**
2263 * Filters out all tt_content uids which are already translated so only non-translated uids is left.
2264 * Selects across columns, but within in the same PID. Columns are expect to be the same
2265 * for translations and original but this may be a conceptual error (?)
2266 *
2267 * @param array $defaultLanguageUids Numeric array with uids of tt_content elements in the default language
2268 * @param int $id Page pid
2269 * @param int $lP Sys language UID
2270 * @return array Modified $defLanguageCount
2271 */
2272 public function getNonTranslatedTTcontentUids($defaultLanguageUids, $id, $lP)
2273 {
2274 if ($lP && !empty($defaultLanguageUids)) {
2275 // Select all translations here:
2276 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
2277 ->getQueryBuilderForTable('tt_content');
2278 $queryBuilder->getRestrictions()
2279 ->removeAll()
2280 ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
2281 $queryBuilder
2282 ->select('*')
2283 ->from('tt_content')
2284 ->where(
2285 $queryBuilder->expr()->eq(
2286 'sys_language_uid',
2287 $queryBuilder->createNamedParameter($lP, \PDO::PARAM_INT)
2288 ),
2289 $queryBuilder->expr()->in(
2290 'l18n_parent',
2291 $queryBuilder->createNamedParameter($defaultLanguageUids, Connection::PARAM_INT_ARRAY)
2292 )
2293 );
2294
2295 $result = $queryBuilder->execute();
2296
2297 // Flip uids:
2298 $defaultLanguageUids = array_flip($defaultLanguageUids);
2299 // Traverse any selected elements and unset original UID if any:
2300 while ($row = $result->fetch()) {
2301 BackendUtility::workspaceOL('tt_content', $row);
2302 unset($defaultLanguageUids[$row['l18n_parent']]);
2303 }
2304 // Flip again:
2305 $defaultLanguageUids = array_keys($defaultLanguageUids);
2306 }
2307 return $defaultLanguageUids;
2308 }
2309
2310 /**
2311 * Creates button which is used to create copies of records..
2312 *
2313 * @param array $defaultLanguageUids Numeric array with uids of tt_content elements in the default language
2314 * @param int $lP Sys language UID
2315 * @param int $colPos Column position
2316 * @return string "Copy languages" button, if available.
2317 */
2318 public function newLanguageButton($defaultLanguageUids, $lP, $colPos = 0)
2319 {
2320 $lP = (int)$lP;
2321 if (!$this->doEdit || !$lP) {
2322 return '';
2323 }
2324 $theNewButton = '';
2325
2326 $localizationTsConfig = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.localization');
2327 $allowCopy = isset($localizationTsConfig['properties']['enableCopy'])
2328 ? (int)$localizationTsConfig['properties']['enableCopy'] === 1
2329 : true;
2330 $allowTranslate = isset($localizationTsConfig['properties']['enableTranslate'])
2331 ? (int)$localizationTsConfig['properties']['enableTranslate'] === 1
2332 : true;
2333
2334 if (!empty($this->languageHasTranslationsCache[$lP])) {
2335 if (isset($this->languageHasTranslationsCache[$lP]['hasStandAloneContent'])) {
2336 $allowTranslate = false;
2337 }
2338 if (isset($this->languageHasTranslationsCache[$lP]['hasTranslations'])) {
2339 $allowCopy = false;
2340 }
2341 }
2342
2343 if (isset($this->contentElementCache[$lP][$colPos]) && is_array($this->contentElementCache[$lP][$colPos])) {
2344 foreach ($this->contentElementCache[$lP][$colPos] as $record) {
2345 $key = array_search($record['l10n_source'], $defaultLanguageUids);
2346 if ($key !== false) {
2347 unset($defaultLanguageUids[$key]);
2348 }
2349 }
2350 }
2351
2352 if (!empty($defaultLanguageUids)) {
2353 $theNewButton =
2354 '<input'
2355 . ' class="btn btn-default t3js-localize"'
2356 . ' type="button"'
2357 . ' disabled'
2358 . ' value="' . htmlspecialchars($this->getLanguageService()->getLL('newPageContent_translate')) . '"'
2359 . ' data-has-elements="' . (int)!empty($this->contentElementCache[$lP][$colPos]) . '"'
2360 . ' data-allow-copy="' . (int)$allowCopy . '"'
2361 . ' data-allow-translate="' . (int)$allowTranslate . '"'
2362 . ' data-table="tt_content"'
2363 . ' data-page-id="' . (int)GeneralUtility::_GP('id') . '"'
2364 . ' data-language-id="' . $lP . '"'
2365 . ' data-language-name="' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '"'
2366 . ' data-colpos-id="' . $colPos . '"'
2367 . ' data-colpos-name="' . BackendUtility::getProcessedValue('tt_content', 'colPos', $colPos) . '"'
2368 . '/>';
2369 }
2370
2371 return '<div class="t3-page-lang-copyce">' . $theNewButton . '</div>';
2372 }
2373
2374 /**
2375 * Creates onclick-attribute content for a new content element
2376 *
2377 * @param int $id Page id where to create the element.
2378 * @param int $colPos Preset: Column position value
2379 * @param int $sys_language Preset: Sys langauge value
2380 * @return string String for onclick attribute.
2381 * @see getTable_tt_content()
2382 */
2383 public function newContentElementOnClick($id, $colPos, $sys_language)
2384 {
2385 if ($this->option_newWizard) {
2386 $tsConfig = BackendUtility::getModTSconfig($id, 'mod');
2387 $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
2388 ? $tsConfig['properties']['newContentElementWizard.']['override']
2389 : 'new_content_element_wizard';
2390 $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($moduleName) . '&id=' . $id . '&colPos=' . $colPos
2391 . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id
2392 . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';';
2393 } else {
2394 $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]='
2395 . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language);
2396 }
2397 return $onClick;
2398 }
2399
2400 /**
2401 * Will create a link on the input string and possibly a big button after the string which links to editing in the RTE.
2402 * Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
2403 *
2404 * @param string $str String to link. Must be prepared for HTML output.
2405 * @param array $row The row.
2406 * @return string If the whole thing was editable ($this->doEdit) $str is return with link around. Otherwise just $str.
2407 * @see getTable_tt_content()
2408 */
2409 public function linkEditContent($str, $row)
2410 {
2411 if ($this->doEdit && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
2412 $urlParameters = [
2413 'edit' => [
2414 'tt_content' => [
2415 $row['uid'] => 'edit'
2416 ]
2417 ],
2418 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid']
2419 ];
2420 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
2421 // Return link
2422 return '<a href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">' . $str . '</a>';
2423 }
2424 return $str;
2425 }
2426
2427 /**
2428 * Make selector box for creating new translation in a language
2429 * Displays only languages which are not yet present for the current page and
2430 * that are not disabled with page TS.
2431 *
2432 * @param int $id Page id for which to create a new translation record of pages
2433 * @return string <select> HTML element (if there were items for the box anyways...)
2434 * @see getTable_tt_content()
2435 */
2436 public function languageSelector($id)
2437 {
2438 if ($this->getBackendUser()->check('tables_modify', 'pages')) {
2439 // First, select all
2440 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
2441 $queryBuilder->getRestrictions()->removeAll();
2442 $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(HiddenRestriction::class));
2443 $statement = $queryBuilder->select('uid', 'title')
2444 ->from('sys_language')
2445 ->orderBy('sorting')
2446 ->execute();
2447 $availableTranslations = [];
2448 while ($row = $statement->fetch()) {
2449 if ($this->getBackendUser()->checkLanguageAccess($row['uid'])) {
2450 $availableTranslations[(int)$row['uid']] = $row['title'];
2451 }
2452 }
2453 // Then, subtract the languages which are already on the page:
2454 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
2455 $queryBuilder->getRestrictions()->removeAll();
2456 $queryBuilder->select('sys_language.uid AS uid', 'sys_language.title AS title')
2457 ->from('sys_language')
2458 ->join(
2459 'sys_language',
2460 'pages',
2461 'pages',
2462 $queryBuilder->expr()->eq('sys_language.uid', $queryBuilder->quoteIdentifier('pages.sys_language_uid'))
2463 )
2464 ->where(
2465 $queryBuilder->expr()->eq(
2466 'pages.deleted',
2467 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
2468 ),
2469 $queryBuilder->expr()->eq(
2470 'pages.l10n_parent',
2471 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
2472 ),
2473 $queryBuilder->expr()->orX(
2474 $queryBuilder->expr()->gte(
2475 'pages.t3ver_state',
2476 $queryBuilder->createNamedParameter(
2477 (string)new VersionState(VersionState::DEFAULT_STATE),
2478 \PDO::PARAM_INT
2479 )
2480 ),
2481 $queryBuilder->expr()->eq(
2482 'pages.t3ver_wsid',
2483 $queryBuilder->createNamedParameter($this->getBackendUser()->workspace, \PDO::PARAM_INT)
2484 )
2485 )
2486 )
2487 ->groupBy(
2488 'pages.sys_language_uid',
2489 'sys_language.uid',
2490 'sys_language.pid',
2491 'sys_language.tstamp',
2492 'sys_language.hidden',
2493 'sys_language.title',
2494 'sys_language.language_isocode',
2495 'sys_language.static_lang_isocode',
2496 'sys_language.flag',
2497 'sys_language.sorting'
2498 )
2499 ->orderBy('sys_language.sorting');
2500 if (!$this->getBackendUser()->isAdmin()) {
2501 $queryBuilder->andWhere(
2502 $queryBuilder->expr()->eq(
2503 'sys_language.hidden',
2504 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
2505 )
2506 );
2507 }
2508 $statement = $queryBuilder->execute();
2509 while ($row = $statement->fetch()) {
2510 unset($availableTranslations[(int)$row['uid']]);
2511 }
2512 // Remove disallowed languages
2513 if (!empty($availableTranslations)
2514 && !$this->getBackendUser()->isAdmin()
2515 && $this->getBackendUser()->groupData['allowed_languages'] !== ''
2516 ) {
2517 $allowed_languages = array_flip(explode(',', $this->getBackendUser()->groupData['allowed_languages']));
2518 if (!empty($allowed_languages)) {
2519 foreach ($availableTranslations as $key => $value) {
2520 if (!isset($allowed_languages[$key]) && $key != 0) {
2521 unset($availableTranslations[$key]);
2522 }
2523 }
2524 }
2525 }
2526 // Remove disabled languages
2527 $modSharedTSconfig = BackendUtility::getModTSconfig($id, 'mod.SHARED');
2528 $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages'])
2529 ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true)
2530 : [];
2531 if (!empty($availableTranslations) && !empty($disableLanguages)) {
2532 foreach ($disableLanguages as $language) {
2533 if ($language != 0 && isset($availableTranslations[$language])) {
2534 unset($availableTranslations[$language]);
2535 }
2536 }
2537 }
2538 // If any languages are left, make selector:
2539 if (!empty($availableTranslations)) {
2540 $output = '<option value=""></option>';
2541 foreach ($availableTranslations as $languageUid => $languageTitle) {
2542 // Build localize command URL to DataHandler (tce_db)
2543 // which redirects to FormEngine (record_edit)
2544 // which, when finished editing should return back to the current page (returnUrl)
2545 $parameters = [
2546 'justLocalized' => 'pages:' . $id . ':' . $languageUid,
2547 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
2548 ];
2549 $redirectUrl = BackendUtility::getModuleUrl('record_edit', $parameters);
2550 $targetUrl = BackendUtility::getLinkToDataHandlerAction(
2551 '&cmd[pages][' . $id . '][localize]=' . $languageUid,
2552 $redirectUrl
2553 );
2554
2555 $output .= '<option value="' . htmlspecialchars($targetUrl) . '">' . htmlspecialchars($languageTitle) . '</option>';
2556 }
2557
2558 return '<div class="form-inline form-inline-spaced">'
2559 . '<div class="form-group">'
2560 . '<label for="createNewLanguage">'
2561 . htmlspecialchars($this->getLanguageService()->getLL('new_language'))
2562 . '</label>'
2563 . '<select class="form-control input-sm" name="createNewLanguage" onchange="window.location.href=this.options[this.selectedIndex].value">'
2564 . $output
2565 . '</select></div></div>';
2566 }
2567 }
2568 return '';
2569 }
2570
2571 /**
2572 * Traverse the result pointer given, adding each record to array and setting some internal values at the same time.
2573 *
2574 * @param Statement $result DBAL Statement
2575 * @param string $table Table name defaulting to tt_content
2576 * @return array The selected rows returned in this array.
2577 */
2578 public function getResult(Statement $result, string $table = 'tt_content'): array
2579 {
2580 $output = [];
2581 // Traverse the result:
2582 while ($row = $result->fetch()) {
2583 BackendUtility::workspaceOL($table, $row, -99, true);
2584 if ($row) {
2585 // Add the row to the array:
2586 $output[] = $row;
2587 }
2588 }
2589 $this->generateTtContentDataArray($output);
2590 // Return selected records
2591 return $output;
2592 }
2593
2594 /********************************
2595 *
2596 * Various helper functions
2597 *
2598 ********************************/
2599
2600 /**
2601 * Initializes the clipboard for generating paste links
2602 *
2603 *
2604 * @see \TYPO3\CMS\Recordlist\RecordList::main()
2605 * @see \TYPO3\CMS\Backend\Controller\ContextMenuController::clipboardAction()
2606 * @see \TYPO3\CMS\Filelist\Controller\FileListController::indexAction()
2607 */
2608 protected function initializeClipboard()
2609 {
2610 // Start clipboard
2611 $this->clipboard = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
2612
2613 // Initialize - reads the clipboard content from the user session
2614 $this->clipboard->initializeClipboard();
2615
2616 // This locks the clipboard to the Normal for this request.
2617 $this->clipboard->lockToNormal();
2618
2619 // Clean up pad
2620 $this->clipboard->cleanCurrent();
2621
2622 // Save the clipboard content
2623 $this->clipboard->endClipboard();
2624 }
2625
2626 /**
2627 * Generates the data for previous and next elements which is needed for movements.
2628 *
2629 * @param array $rowArray
2630 */
2631 protected function generateTtContentDataArray(array $rowArray)
2632 {
2633 if (empty($this->tt_contentData)) {
2634 $this->tt_contentData = [
2635 'nextThree' => [],
2636 'next' => [],
2637 'prev' => [],
2638 ];
2639 }
2640 foreach ($rowArray as $key => $value) {
2641 // Create the list of the next three ids (for editing links...)
2642 for ($i = 0; $i < $this->nextThree; $i++) {
2643 if (isset($rowArray[$key - $i])
2644 && !GeneralUtility::inList($this->tt_contentData['nextThree'][$rowArray[$key - $i]['uid']], $value['uid'])
2645 ) {
2646 $this->tt_contentData['nextThree'][$rowArray[$key - $i]['uid']] .= $value['uid'] . ',';
2647 }
2648 }
2649
2650 // Create information for next and previous content elements
2651 if (isset($rowArray[$key - 1])) {
2652 if (isset($rowArray[$key - 2])) {
2653 $this->tt_contentData['prev'][$value['uid']] = -$rowArray[$key - 2]['uid'];
2654 } else {
2655 $this->tt_contentData['prev'][$value['uid']] = $value['pid'];
2656 }
2657 $this->tt_contentData['next'][$rowArray[$key - 1]['uid']] = -$value['uid'];
2658 }
2659 }
2660 }
2661
2662 /**
2663 * Counts and returns the number of records on the page with $pid
2664 *
2665 * @param string $table Table name
2666 * @param int $pid Page id
2667 * @return int Number of records.
2668 */
2669 public function numberOfRecords($table, $pid)
2670 {
2671 $count = 0;
2672 if ($GLOBALS['TCA'][$table]) {
2673 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
2674 ->getQueryBuilderForTable($table);
2675 $queryBuilder->getRestrictions()
2676 ->removeAll()
2677 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
2678 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
2679 $count = (int)$queryBuilder->count('uid')
2680 ->from($table)
2681 ->where(
2682 $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT))
2683 )
2684 ->execute()
2685 ->fetchColumn();
2686 }
2687
2688 return $count;
2689 }
2690
2691 /**
2692 * Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping etc.
2693 *
2694 * @param string $input Input string
2695 * @return string Output string
2696 */
2697 public function renderText($input)
2698 {
2699 $input = strip_tags($input);
2700 $input = GeneralUtility::fixed_lgd_cs($input, 1500);
2701 return nl2br(htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8', false));
2702 }
2703
2704 /**
2705 * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu.
2706 *
2707 * @param string $table Table name
2708 * @param array $row Record array
2709 * @param string $enabledClickMenuItems Passthrough to wrapClickMenuOnIcon
2710 * @return string HTML for the icon
2711 */
2712 public function getIcon($table, $row, $enabledClickMenuItems = '')
2713 {
2714 // Initialization
2715 $toolTip = BackendUtility::getRecordToolTip($row, 'tt_content');
2716 $icon = '<span ' . $toolTip . '>' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
2717 $this->counter++;
2718 // The icon with link
2719 if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) {
2720 $icon = BackendUtility::wrapClickMenuOnIcon($icon, $table, $row['uid']);
2721 }
2722 return $icon;
2723 }
2724
2725 /**
2726 * Creates processed values for all field names in $fieldList based on values from $row array.
2727 * The result is 'returned' through $info which is passed as a reference
2728 *
2729 * @param string $table Table name
2730 * @param string $fieldList Comma separated list of fields.
2731 * @param array $row Record from which to take values for processing.
2732 * @param array $info Array to which the processed values are added.
2733 */
2734 public function getProcessedValue($table, $fieldList, array $row, array &$info)
2735 {
2736 // Splitting values from $fieldList
2737 $fieldArr = explode(',', $fieldList);
2738 // Traverse fields from $fieldList
2739 foreach ($fieldArr as $field) {
2740 if ($row[$field]) {
2741 $info[] = '<strong>' . htmlspecialchars($this->itemLabels[$field]) . '</strong> '
2742 . htmlspecialchars(BackendUtility::getProcessedValue($table, $field, $row[$field]));
2743 }
2744 }
2745 }
2746
2747 /**
2748 * Returns TRUE, if the record given as parameters is NOT visible based on hidden/starttime/endtime (if available)
2749 *
2750 * @param string $table Tablename of table to test
2751 * @param array $row Record row.
2752 * @return bool Returns TRUE, if disabled.
2753 */
2754 public function isDisabled($table, $row)
2755 {
2756 $enableCols = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
2757 return $enableCols['disabled'] && $row[$enableCols['disabled']]
2758 || $enableCols['starttime'] && $row[$enableCols['starttime']] > $GLOBALS['EXEC_TIME']
2759 || $enableCols['endtime'] && $row[$enableCols['endtime']] && $row[$enableCols['endtime']] < $GLOBALS['EXEC_TIME'];
2760 }
2761
2762 /**
2763 * Returns icon for "no-edit" of a record.
2764 * Basically, the point is to signal that this record could have had an edit link if
2765 * the circumstances were right. A placeholder for the regular edit icon...
2766 *
2767 * @param string $label Label key from LOCAL_LANG
2768 * @return string IMG tag for icon.
2769 */
2770 public function noEditIcon($label = 'noEditItems')
2771 {
2772 $title = htmlspecialchars($this->getLanguageService()->getLL($label));
2773 return '<span title="' . $title . '">' . $this->iconFactory->getIcon('status-edit-read-only', Icon::SIZE_SMALL)->render() . '</span>';
2774 }
2775
2776 /*****************************************
2777 *
2778 * External renderings
2779 *
2780 *****************************************/
2781
2782 /**
2783 * Creates a menu of the tables that can be listed by this function
2784 * Only tables which has records on the page will be included.
2785 * Notice: The function also fills in the internal variable $this->activeTables with icon/titles.
2786 *
2787 * @param int $id Page id from which we are listing records (the function will look up if there are records on the page)
2788 * @return string HTML output.
2789 */
2790 public function getTableMenu($id)
2791 {
2792 // Initialize:
2793 $this->activeTables = [];
2794 $theTables = ['tt_content'];
2795 // External tables:
2796 if (is_array($this->externalTables)) {
2797 $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
2798 }
2799 $out = '';
2800 // Traverse tables to check:
2801 foreach ($theTables as $tName) {
2802 // Check access and whether the proper extensions are loaded:
2803 if ($this->getBackendUser()->check('tables_select', $tName)
2804 && (
2805 isset($this->externalTables[$tName])
2806 || $tName === 'fe_users' || $tName === 'tt_content'
2807 || \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($tName)
2808 )
2809 ) {
2810 // Make query to count records from page:
2811 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
2812 ->getQueryBuilderForTable($tName);
2813 $queryBuilder->getRestrictions()
2814 ->removeAll()
2815 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
2816 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
2817 $count = $queryBuilder->count('uid')
2818 ->from($tName)
2819 ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)))
2820 ->execute()
2821 ->fetchColumn();
2822 // If records were found (or if "tt_content" is the table...):
2823 if ($count || $tName === 'tt_content') {
2824 // Add row to menu:
2825 $out .= '
2826 <td><a href="#' . $tName . '" title="' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title'])) . '"></a>'
2827 . $this->iconFactory->getIconForRecord($tName, [], Icon::SIZE_SMALL)->render()
2828 . '</td>';
2829 // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
2830 $title = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title']))
2831 . ': ' . $count . ' ' . htmlspecialchars($this->getLanguageService()->getLL('records'));
2832 $this->activeTables[$tName] = '<span title="' . $title . '">'
2833 . $this->iconFactory->getIconForRecord($tName, [], Icon::SIZE_SMALL)->render()
2834 . '</span>'
2835 . '&nbsp;' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title']));
2836 }
2837 }
2838 }
2839 // Wrap cells in table tags:
2840 $out = '
2841 <!--
2842 Menu of tables on the page (table menu)
2843 -->
2844 <table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
2845 <tr>' . $out . '
2846 </tr>
2847 </table>';
2848 // Return the content:
2849 return $out;
2850 }
2851
2852 /**
2853 * Create thumbnail code for record/field but not linked
2854 *
2855 * @param mixed[] $row Record array
2856 * @param string $table Table (record is from)
2857 * @param string $field Field name for which thumbnail are to be rendered.
2858 * @return string HTML for thumbnails, if any.
2859 */
2860 public function getThumbCodeUnlinked($row, $table, $field)
2861 {
2862 return BackendUtility::thumbCode($row, $table, $field, '', '', null, 0, '', '', false);
2863 }
2864
2865 /**
2866 * Checks whether translated Content Elements exist in the desired language
2867 * If so, deny creating new ones via the UI
2868 *
2869 * @param array $contentElements
2870 * @param int $language
2871 * @return bool
2872 */
2873 protected function checkIfTranslationsExistInLanguage(array $contentElements, $language)
2874 {
2875 // If in default language, you may always create new entries
2876 // Also, you may override this strict behavior via user TS Config
2877 // If you do so, you're on your own and cannot rely on any support by the TYPO3 core
2878 // We jump out here since we don't need to do the expensive loop operations
2879 $allowInconsistentLanguageHandling = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.allowInconsistentLanguageHandling');
2880 if ($language === 0 || $allowInconsistentLanguageHandling['value'] === '1') {
2881 return false;
2882 }
2883 /**
2884 * Build up caches
2885 */
2886 if (!isset($this->languageHasTranslationsCache[$language])) {
2887 foreach ($contentElements as $columns) {
2888 foreach ($columns as $contentElement) {
2889 if ((int)$contentElement['l18n_parent'] === 0) {
2890 $this->languageHasTranslationsCache[$language]['hasStandAloneContent'] = true;
2891 }
2892 if ((int)$contentElement['l18n_parent'] > 0) {
2893 $this->languageHasTranslationsCache[$language]['hasTranslations'] = true;
2894 }
2895 }
2896 }
2897 // Check whether we have a mix of both
2898 if ($this->languageHasTranslationsCache[$language]['hasStandAloneContent']
2899 && $this->languageHasTranslationsCache[$language]['hasTranslations']
2900 ) {
2901 $message = GeneralUtility::makeInstance(
2902 FlashMessage::class,
2903 sprintf($this->getLanguageService()->getLL('staleTranslationWarning'), $this->languageIconTitles[$language]['title']),
2904 sprintf($this->getLanguageService()->getLL('staleTranslationWarningTitle'), $this->languageIconTitles[$language]['title']),
2905 FlashMessage::WARNING
2906 );
2907 $service = GeneralUtility::makeInstance(FlashMessageService::class);
2908 $queue = $service->getMessageQueueByIdentifier();