3 namespace TYPO3\CMS\Backend\View
;
6 * This file is part of the TYPO3 CMS project.
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.
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
15 * The TYPO3 project - inspiring people to share!
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\UriBuilder
;
25 use TYPO3\CMS\Backend\Tree\View\PageTreeView
;
26 use TYPO3\CMS\Backend\Utility\BackendUtility
;
27 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication
;
28 use TYPO3\CMS\Core\Database\Connection
;
29 use TYPO3\CMS\Core\Database\ConnectionPool
;
30 use TYPO3\CMS\Core\Database\Query\QueryBuilder
;
31 use TYPO3\CMS\Core\Database\Query\QueryHelper
;
32 use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction
;
33 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
;
34 use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction
;
35 use TYPO3\CMS\Core\Imaging\Icon
;
36 use TYPO3\CMS\Core\Imaging\IconFactory
;
37 use TYPO3\CMS\Core\Localization\LanguageService
;
38 use TYPO3\CMS\Core\Messaging\FlashMessage
;
39 use TYPO3\CMS\Core\Messaging\FlashMessageService
;
40 use TYPO3\CMS\Core\Page\PageRenderer
;
41 use TYPO3\CMS\Core\Service\DependencyOrderingService
;
42 use TYPO3\CMS\Core\Type\Bitmask\Permission
;
43 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility
;
44 use TYPO3\CMS\Core\Utility\GeneralUtility
;
45 use TYPO3\CMS\Core\Utility\HttpUtility
;
46 use TYPO3\CMS\Core\Utility\MathUtility
;
47 use TYPO3\CMS\Core\Utility\StringUtility
;
48 use TYPO3\CMS\Core\Versioning\VersionState
;
49 use TYPO3\CMS\Extbase\Service\FlexFormService
;
50 use TYPO3\CMS\Fluid\View\StandaloneView
;
51 use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
;
54 * Child class for the Web > Page module
56 class PageLayoutView
implements LoggerAwareInterface
61 * If TRUE, users/groups are shown in the page info box.
65 public $pI_showUser = false;
68 * The number of successive records to edit when showing content elements.
72 public $nextThree = 3;
75 * If TRUE, disables the edit-column icon for tt_content elements
79 public $pages_noEditColumns = false;
82 * If TRUE, new-wizards are linked to rather than the regular new-element list.
86 public $option_newWizard = true;
89 * If set to "1", will link a big button to content element wizard.
93 public $ext_function = 0;
96 * If TRUE, elements will have edit icons (probably this is whether the user has permission to edit the page content). Set externally.
100 public $doEdit = true;
103 * Age prefixes for displaying times. May be set externally to localized values.
107 public $agePrefixes = ' min| hrs| days| yrs| min| hour| day| year';
110 * Array of tables to be listed by the Web > Page module in addition to the default tables.
114 public $externalTables = [];
117 * "Pseudo" Description -table name
124 * If set TRUE, the language mode of tt_content elements will be rendered with hard binding between
125 * default language content elements and their translations!
129 public $defLangBinding = false;
132 * External, static: Configuration of tt_content element display:
136 public $tt_contentConfig = [
137 // Boolean: Display info-marks or not
139 // Boolean: Display up/down arrows and edit icons for tt_content records
143 'languageColsPointer' => 0,
145 // Displays hidden records as well
146 'sys_language_uid' => 0,
149 'activeCols' => '1,0,2,3'
150 // Which columns can be accessed by current BE user
154 * Contains icon/title of pages which are listed in the tables menu (see getTableMenu() function )
158 public $activeTables = [];
163 public $tt_contentData = [
170 * Used to store labels for CTypes for tt_content elements
174 public $CType_labels = [];
177 * Used to store labels for the various fields in tt_content elements
181 public $itemLabels = [];
184 * Indicates if all available fields for a user should be selected or not.
188 public $allFields = 0;
191 * Number of records to show
195 public $showLimit = 0;
198 * Shared module configuration, used by localization features
202 public $modSharedTSconfig = [];
205 * Tables which should not get listed
209 public $hideTables = '';
212 * Containing which fields to display in extended mode
216 public $displayFields;
219 * Tables which should not list their translations
223 public $hideTranslations = '';
226 * If set, csvList is outputted.
230 public $csvOutput = false;
233 * Cache for record path
237 public $recPath_cache = [];
240 * Field, to sort list by
247 * default Max items shown per table in "multi-table mode", may be overridden by tables.php
251 public $itemsLimitPerTable = 20;
254 * Page select permissions
258 public $perms_clause = '';
272 public $returnUrl = '';
275 * Tablename if single-table mode
282 * Some permissions...
286 public $calcPerms = 0;
289 * Mode for what happens when a user clicks the title of a record.
293 public $clickTitleMode = '';
296 * Levels to search down.
300 public $searchLevels = '';
310 * Set to the total number of items for a table when selecting.
314 public $totalItems = '';
317 * TSconfig which overwrites TCA-Settings
321 public $tableTSconfigOverTCA = [];
324 * Loaded with page record with version overlay if any.
328 public $pageRecord = [];
331 * Used for tracking duplicate values of fields
335 public $duplicateStack = [];
338 * Fields to display for the current table
342 public $setFields = [];
345 * Current script name
349 public $script = 'index.php';
352 * If TRUE, records are listed only if a specific table is selected.
356 public $listOnlyInSingleTableMode = false;
359 * JavaScript code accumulation
366 * Pointer for browsing list
370 public $firstElementNumber = 0;
373 * Counting the elements no matter what...
377 public $eCounter = 0;
384 public $searchString = '';
387 * default Max items shown per table in "single-table mode", may be overridden by tables.php
391 public $itemsLimitSingleTable = 100;
394 * Field, indicating to sort in reverse order.
401 * String, can contain the field name from a table which must have duplicate values marked.
405 public $duplicateField;
408 * Specify a list of tables which are the only ones allowed to be displayed.
412 public $tableList = '';
415 * Array of collapsed / uncollapsed tables in multi table view
419 public $tablesCollapsed = [];
422 * @var array[] Module configuration
431 public $HTMLcode = '';
434 * Thumbnails on records containing files (pictures)
441 * Used for tracking next/prev uids
445 public $currentTable = [];
448 * OBSOLETE - NOT USED ANYMORE. leftMargin
452 public $leftMargin = 0;
455 * Decides the columns shown. Filled with values that refers to the keys of the data-array. $this->fieldArray[0] is the title column.
459 public $fieldArray = [];
462 * Set to zero, if you don't want a left-margin with addElement function
466 public $setLMargin = 1;
469 * Contains page translation languages
473 public $pageOverlays = [];
476 * Counter increased for each element. Used to index elements for the JavaScript-code that transfers to the clipboard
483 * Contains sys language icons and titles
487 public $languageIconTitles = [];
494 public $thisScript = '';
497 * If set this is <td> CSS-classname for odd columns in addElement. Used with db_layout / pages section
501 public $oddColumnsCssClass = '';
504 * Not used in this class - but maybe extension classes...
505 * Max length of strings
512 * @var TranslationConfigurationProvider
514 public $translateTools;
517 * Keys are fieldnames and values are td-parameters to add in addElement(), please use $addElement_tdCSSClass for CSS-classes;
521 public $addElement_tdParams = [];
526 public $no_noWrap = 0;
531 public $showIcon = 1;
534 * Keys are fieldnames and values are td-css-classes to add in addElement();
538 public $addElement_tdCssClass = [];
541 * @var \TYPO3\CMS\Backend\Clipboard\Clipboard
543 protected $clipboard;
550 public $ext_CALC_PERMS;
553 * Current ids page record
560 * Caches the available languages in a colPos
564 protected $languagesInColumnCache = [];
567 * Caches the amount of content elements as a matrix
572 protected $contentElementCache = [];
577 protected $iconFactory;
580 * Stores whether a certain language has translations in it
584 protected $languageHasTranslationsCache = [];
587 * @var LocalizationController
589 protected $localizationController;
592 * Override the page ids taken into account by getPageIdConstraint()
596 protected $overridePageIdList = [];
599 * Override/add urlparameters in listUrl() method
603 protected $overrideUrlParameters = [];
606 * Array with before/after setting for tables
609 * 'before' => ['A', ...]
614 protected $tableDisplayOrder = [];
617 * Construct to initialize class variables.
619 public function __construct()
621 if (isset($GLOBALS['BE_USER']->uc
['titleLen']) && $GLOBALS['BE_USER']->uc
['titleLen'] > 0) {
622 $this->fixedL
= $GLOBALS['BE_USER']->uc
['titleLen'];
624 $this->iconFactory
= GeneralUtility
::makeInstance(IconFactory
::class);
625 $this->getTranslateTools();
626 $this->determineScriptUrl();
627 $this->localizationController
= GeneralUtility
::makeInstance(LocalizationController
::class);
628 $this->iconFactory
= GeneralUtility
::makeInstance(IconFactory
::class);
629 $pageRenderer = GeneralUtility
::makeInstance(PageRenderer
::class);
630 $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_layout.xlf');
631 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
632 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Localization');
635 /*****************************************
639 *****************************************/
641 * Adds the code of a single table
643 * @param string $table Table name
644 * @param int $id Current page id
645 * @param string $fields
646 * @return string HTML for listing.
648 public function getTable($table, $id, $fields = '')
650 if (isset($this->externalTables
[$table])) {
651 return $this->getExternalTables($id, $table);
653 // Branch out based on table name:
656 return $this->getTable_pages($id);
659 return $this->getTable_tt_content($id);
667 * Renders an external table from page id
669 * @param int $id Page id
670 * @param string $table Name of the table
671 * @return string HTML for the listing
673 public function getExternalTables($id, $table)
675 $this->pageinfo
= BackendUtility
::readPageAccess($id, '');
676 $type = $this->getPageLayoutController()->MOD_SETTINGS
[$table];
680 // eg. "name;title;email;company,image"
681 $fList = $this->externalTables
[$table][$type]['fList'];
682 // The columns are separeted by comma ','.
683 // Values separated by semicolon ';' are shown in the same column.
684 $icon = $this->externalTables
[$table][$type]['icon'];
685 $addWhere = $this->externalTables
[$table][$type]['addWhere'];
687 $out = $this->makeOrdinaryList($table, $id, $fList, $icon, $addWhere);
692 * Renders records from the pages table from page id
693 * (Used to get information about the page tree content by "Web>Info"!)
695 * @param int $id Page id
696 * @return string HTML for the listing
698 public function getTable_pages($id)
702 $lang = $this->getLanguageService();
703 // Select current page:
705 // The root has a pseudo record in pageinfo...
706 $row = $this->getPageLayoutController()->pageinfo
;
708 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)
709 ->getQueryBuilderForTable('pages');
710 $queryBuilder->getRestrictions()
712 ->add(GeneralUtility
::makeInstance(DeletedRestriction
::class));
717 $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($id, \PDO
::PARAM_INT
)),
718 $this->getBackendUser()->getPagePermsClause(Permission
::PAGE_SHOW
)
722 BackendUtility
::workspaceOL('pages', $row);
724 // If there was found a page:
725 if (is_array($row)) {
726 // Getting select-depth:
727 $depth = (int)$this->getPageLayoutController()->MOD_SETTINGS
['pages_levels'];
728 // Overriding a few things:
729 $this->no_noWrap
= 0;
731 $this->eCounter
= $this->firstElementNumber
;
732 // Creating elements:
733 list($flag, $code) = $this->fwd_rwd_nav();
738 $theRows = $this->getPageRecordsRecursive($row['uid'], $depth);
739 if ($this->getBackendUser()->doesUserHaveAccess($row, 2) && $row['uid'] > 0) {
740 $editUids[] = $row['uid'];
742 $out .= $this->pages_drawItem($row, $this->fieldArray
);
743 // Traverse all pages selected:
744 foreach ($theRows as $sRow) {
745 if ($this->getBackendUser()->doesUserHaveAccess($sRow, 2)) {
746 $editUids[] = $sRow['uid'];
748 $out .= $this->pages_drawItem($sRow, $this->fieldArray
);
752 // Header line is drawn
754 $editIdList = implode(',', $editUids);
755 // Traverse fields (as set above) in order to create header values:
756 foreach ($this->fieldArray
as $field) {
758 && isset($GLOBALS['TCA']['pages']['columns'][$field])
760 && !$this->pages_noEditColumns
763 $lang->getLL('editThisColumn'),
764 rtrim(trim($lang->sL(BackendUtility
::getItemLabel('pages', $field))), ':')
769 $editIdList => 'edit'
772 'columnsOnly' => $field,
773 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
775 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
776 $url = (string)$uriBuilder->buildUriFromRoute('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>';
785 $theData[$field] = ' ' . $eI . '<strong>'
786 . $lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label'])
790 $theData[$field] = ' <strong>ID:</strong>';
793 if (substr($field, 0, 6) === 'table_') {
794 $f2 = substr($field, 6);
795 if ($GLOBALS['TCA'][$f2]) {
796 $theData[$field] = ' ' .
798 htmlspecialchars($lang->sL($GLOBALS['TCA'][$f2]['ctrl']['title'])) .
800 $this->iconFactory
->getIconForRecord($f2, [], Icon
::SIZE_SMALL
)->render() .
804 $theData[$field] = ' ' . $eI . '<strong>'
805 . htmlspecialchars($lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label']))
810 $out = '<div class="table-fit">'
811 . '<table class="table table-striped table-hover typo3-page-pages">'
813 . $this->addElement(1, '', $theData)
825 * Renders Content Elements from the tt_content table from page id
827 * @param int $id Page id
828 * @return string HTML for the listing
830 public function getTable_tt_content($id)
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);
852 if (!empty($pageLocalizationRecord['uid'])) {
853 $languageOverlayId = $pageLocalizationRecord['uid'];
855 $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
856 PageActions.setPageId(' . (int)$this->id
. ');
857 PageActions.setLanguageOverlayId(' . $languageOverlayId . ');
858 PageActions.initializePageTitleRenaming();
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]);
866 $this->itemLabels
= [];
867 foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) {
868 $this->itemLabels
[$name] = $this->getLanguageService()->sL($val['label']);
870 $languageColumn = [];
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'];
879 $langList = implode(',', array_keys($this->tt_contentConfig
['languageCols']));
881 $languageColumn = [];
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) {
891 if (!isset($this->contentElementCache
[$lP])) {
892 $this->contentElementCache
[$lP] = [];
895 if (count($langListArr) === 1 ||
$lP === 0) {
896 $showLanguage = $expressionBuilder->in('sys_language_uid', [$lP, -1]);
898 $showLanguage = $expressionBuilder->eq('sys_language_uid', $lP);
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] = [];
915 $defaultLanguageElementsByColumn[$columnId] = [];
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';
922 $content[$columnId] .= '">';
923 // Add new content at the top most position
925 if ($this->getPageLayoutController()->contentIsNotLockedForEditors()
926 && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
928 if ($this->option_newWizard
) {
931 'sys_language_uid' => $lP,
932 'colPos' => $columnId,
934 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
936 $tsConfig = BackendUtility
::getModTSconfig($id, 'mod');
937 $routeName = $tsConfig['properties']['newContentElementWizard.']['override']
938 ??
'new_content_element_wizard';
939 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
940 $url = (string)$uriBuilder->buildUriFromRoute($routeName, $urlParameters);
950 'colPos' => $columnId,
951 'sys_language_uid' => $lP
954 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
956 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
957 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
959 $title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
960 $link = '<a href="#" data-url="' . htmlspecialchars($url) . '" '
961 . 'title="' . $title . '"'
962 . 'data-title="' . $title . '"'
963 . 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
964 . $this->iconFactory
->getIcon('actions-add', Icon
::SIZE_SMALL
)->render()
966 . htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
968 if ($this->getBackendUser()->checkLanguageAccess($lP) && $columnId !== 'unused') {
969 $content[$columnId] .= '
970 <div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . StringUtility
::getUniqueId() . '">
971 <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $columnId . '-' . 'page-' . $id . '-' . StringUtility
::getUniqueId() . '">'
974 <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
979 if (!isset($contentRecordsPerColumn[$columnId]) ||
!is_array($contentRecordsPerColumn[$columnId])) {
980 $message = GeneralUtility
::makeInstance(
982 $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:error.invalidBackendLayout'),
984 FlashMessage
::WARNING
986 $service = GeneralUtility
::makeInstance(FlashMessageService
::class);
987 $queue = $service->getMessageQueueByIdentifier();
988 $queue->addMessage($message);
990 $rowArr = $contentRecordsPerColumn[$columnId];
991 $this->generateTtContentDataArray($rowArr);
993 foreach ((array)$rowArr as $rKey => $row) {
994 $this->contentElementCache
[$lP][$columnId][$row['uid']] = $row;
995 if ($this->tt_contentConfig
['languageMode']) {
996 $languageColumn[$columnId][$lP] = $head[$columnId] . $content[$columnId];
997 if (!$this->defLangBinding
&& $columnId !== 'unused') {
998 $languageColumn[$columnId][$lP] .= $this->newLanguageButton(
999 $this->getNonTranslatedTTcontentUids($defaultLanguageElementsByColumn[$columnId], $id, $lP),
1005 if (is_array($row) && !VersionState
::cast($row['t3ver_state'])->equals(VersionState
::DELETE_PLACEHOLDER
)) {
1006 $singleElementHTML = '';
1007 if (!$lP && ($this->defLangBinding ||
$row['sys_language_uid'] != -1)) {
1008 $defaultLanguageElementsByColumn[$columnId][] = ($row['_ORIG_uid'] ??
$row['uid']);
1010 $editUidList .= $row['uid'] . ',';
1011 $disableMoveAndNewButtons = $this->defLangBinding
&& $lP > 0;
1012 if (!$this->tt_contentConfig
['languageMode']) {
1013 $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility
::getUniqueId() . '">';
1015 $singleElementHTML .= $this->tt_content_drawHeader(
1017 $this->tt_contentConfig
['showInfo'] ?
15 : 5,
1018 $disableMoveAndNewButtons,
1020 $this->getBackendUser()->doesUserHaveAccess($this->pageinfo
, Permission
::CONTENT_EDIT
)
1022 $innerContent = '<div ' . ($row['_ORIG_uid'] ?
' class="ver-element"' : '') . '>'
1023 . $this->tt_content_drawItem($row) . '</div>';
1024 $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>'
1025 . $this->tt_content_drawFooter($row);
1026 $isDisabled = $this->isDisabled('tt_content', $row);
1027 $statusHidden = $isDisabled ?
' t3-page-ce-hidden t3js-hidden-record' : '';
1028 $displayNone = !$this->tt_contentConfig
['showHidden'] && $isDisabled ?
' style="display: none;"' : '';
1029 $highlightHeader = '';
1030 if ($this->checkIfTranslationsExistInLanguage([], (int)$row['sys_language_uid']) && (int)$row['l18n_parent'] === 0) {
1031 $highlightHeader = ' t3-page-ce-danger';
1032 } elseif ($columnId === 'unused') {
1033 $highlightHeader = ' t3-page-ce-warning';
1035 $singleElementHTML = '<div class="t3-page-ce' . $highlightHeader . ' t3js-page-ce t3js-page-ce-sortable ' . $statusHidden . '" id="element-tt_content-'
1036 . $row['uid'] . '" data-table="tt_content" data-uid="' . $row['uid'] . '"' . $displayNone . '>' . $singleElementHTML . '</div>';
1038 if ($this->tt_contentConfig
['languageMode']) {
1039 $singleElementHTML .= '<div class="t3-page-ce t3js-page-ce">';
1041 $singleElementHTML .= '<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $columnId . '-' . 'page-' . $id .
1042 '-' . StringUtility
::getUniqueId() . '">';
1043 // Add icon "new content element below"
1044 if (!$disableMoveAndNewButtons
1045 && $this->getPageLayoutController()->contentIsNotLockedForEditors()
1046 && $this->getBackendUser()->checkLanguageAccess($lP)
1047 && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
1048 && $columnId !== 'unused'
1050 // New content element:
1051 if ($this->option_newWizard
) {
1053 'id' => $row['pid'],
1054 'sys_language_uid' => $row['sys_language_uid'],
1055 'colPos' => $row['colPos'],
1056 'uid_pid' => -$row['uid'],
1057 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1059 $tsConfig = BackendUtility
::getModTSconfig($row['pid'], 'mod');
1060 $routeName = $tsConfig['properties']['newContentElementWizard.']['override']
1061 ??
'new_content_element_wizard';
1062 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1063 $url = (string)$uriBuilder->buildUriFromRoute($routeName, $urlParameters);
1068 -$row['uid'] => 'new'
1071 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1073 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1074 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
1076 $title = htmlspecialchars($this->getLanguageService()->getLL('newContentElement'));
1077 $singleElementHTML .= '<a href="#" data-url="' . htmlspecialchars($url) . '" '
1078 . 'title="' . $title . '"'
1079 . 'data-title="' . $title . '"'
1080 . 'class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">'
1081 . $this->iconFactory
->getIcon('actions-add', Icon
::SIZE_SMALL
)->render()
1083 . htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
1085 $singleElementHTML .= '</div></div><div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div></div>';
1086 if ($this->defLangBinding
&& $this->tt_contentConfig
['languageMode']) {
1087 $defLangBinding[$columnId][$lP][$row[$lP ?
'l18n_parent' : 'uid']] = $singleElementHTML;
1089 $content[$columnId] .= $singleElementHTML;
1092 unset($rowArr[$rKey]);
1095 $content[$columnId] .= '</div>';
1096 $colTitle = BackendUtility
::getProcessedValue('tt_content', 'colPos', $columnId);
1097 $tcaItems = GeneralUtility
::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView
::class . '->getColPosListItemsParsed', $id, $this);
1098 foreach ($tcaItems as $item) {
1099 if ($item[1] == $columnId) {
1100 $colTitle = $this->getLanguageService()->sL($item[0]);
1103 if ($columnId === 'unused') {
1104 if (empty($unusedElementsMessage)) {
1105 $unusedElementsMessage = GeneralUtility
::makeInstance(
1106 FlashMessage
::class,
1107 $this->getLanguageService()->getLL('staleUnusedElementsWarning'),
1108 $this->getLanguageService()->getLL('staleUnusedElementsWarningTitle'),
1109 FlashMessage
::WARNING
1111 $service = GeneralUtility
::makeInstance(FlashMessageService
::class);
1112 $queue = $service->getMessageQueueByIdentifier();
1113 $queue->addMessage($unusedElementsMessage);
1115 $colTitle = $this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:colPos.I.unused');
1118 $editParam = $this->doEdit
&& !empty($rowArr)
1119 ?
'&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc
1122 $head[$columnId] .= $this->tt_content_drawColHeader($colTitle, $editParam);
1125 // For each column, fit the rendered content into a table cell:
1127 if ($this->tt_contentConfig
['languageMode']) {
1128 // in language mode process the content elements, but only fill $languageColumn. output will be generated later
1129 $sortedLanguageColumn = [];
1130 foreach ($cList as $columnId) {
1131 if (GeneralUtility
::inList($this->tt_contentConfig
['activeCols'], $columnId) ||
$columnId === 'unused') {
1132 $languageColumn[$columnId][$lP] = $head[$columnId] . $content[$columnId];
1133 if (!$this->defLangBinding
&& $columnId !== 'unused') {
1134 $languageColumn[$columnId][$lP] .= $this->newLanguageButton(
1135 $this->getNonTranslatedTTcontentUids($defaultLanguageElementsByColumn[$columnId], $id, $lP),
1140 // We sort $languageColumn again according to $cList as it may contain data already from above.
1141 $sortedLanguageColumn[$columnId] = $languageColumn[$columnId];
1144 if (!empty($languageColumn['unused'])) {
1145 $sortedLanguageColumn['unused'] = $languageColumn['unused'];
1147 $languageColumn = $sortedLanguageColumn;
1150 $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">';
1152 $colCount = (int)$backendLayout['__config']['backend_layout.']['colCount'];
1153 $rowCount = (int)$backendLayout['__config']['backend_layout.']['rowCount'];
1154 $grid .= '<colgroup>';
1155 for ($i = 0; $i < $colCount; $i++
) {
1158 $grid .= '</colgroup>';
1159 // Cycle through rows
1160 for ($row = 1; $row <= $rowCount; $row++
) {
1161 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
1162 if (!isset($rowConfig)) {
1166 for ($col = 1; $col <= $colCount; $col++
) {
1167 $columnConfig = $rowConfig['columns.'][$col . '.'];
1168 if (!isset($columnConfig)) {
1171 // Which tt_content colPos should be displayed inside this cell
1172 $columnKey = (int)$columnConfig['colPos'];
1173 // Render the grid cell
1174 $colSpan = (int)$columnConfig['colspan'];
1175 $rowSpan = (int)$columnConfig['rowspan'];
1176 $grid .= '<td valign="top"' .
1177 ($colSpan > 0 ?
' colspan="' . $colSpan . '"' : '') .
1178 ($rowSpan > 0 ?
' rowspan="' . $rowSpan . '"' : '') .
1179 ' 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 .
1180 ((!isset($columnConfig['colPos']) ||
$columnConfig['colPos'] === '') ?
' t3-grid-cell-unassigned' : '') .
1181 ((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) ||
!GeneralUtility
::inList($this->tt_contentConfig
['activeCols'], $columnConfig['colPos']) ?
' t3-grid-cell-restricted' : '') .
1182 ($colSpan > 0 ?
' t3-gridCell-width' . $colSpan : '') .
1183 ($rowSpan > 0 ?
' t3-gridCell-height' . $rowSpan : '') . '">';
1185 // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
1186 // If not, a new header without any buttons will be generated.
1187 if (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey]
1188 && GeneralUtility
::inList($this->tt_contentConfig
['activeCols'], $columnConfig['colPos'])
1190 $grid .= $head[$columnKey] . $content[$columnKey];
1191 } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
1192 && GeneralUtility
::inList($this->tt_contentConfig
['activeCols'], $columnConfig['colPos'])
1194 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'));
1195 } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
1196 && !GeneralUtility
::inList($this->tt_contentConfig
['activeCols'], $columnConfig['colPos'])
1198 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
1199 ' (' . $this->getLanguageService()->getLL('noAccess') . ')');
1200 } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
1201 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name'])
1202 . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')');
1204 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('notAssigned'));
1211 if (!empty($content['unused'])) {
1213 // Which tt_content colPos should be displayed inside this cell
1214 $columnKey = 'unused';
1215 // Render the grid cell
1216 $colSpan = (int)$backendLayout['__config']['backend_layout.']['colCount'];
1217 $grid .= '<td valign="top"' .
1218 ($colSpan > 0 ?
' colspan="' . $colSpan . '"' : '') .
1219 ($rowSpan > 0 ?
' rowspan="' . $rowSpan . '"' : '') .
1220 ' 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 .
1221 ($colSpan > 0 ?
' t3-gridCell-width' . $colSpan : '') . '">';
1223 // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
1224 // If not, a new header without any buttons will be generated.
1225 $grid .= $head[$columnKey] . $content[$columnKey];
1226 $grid .= '</td></tr>';
1228 $out .= $grid . '</table></div>';
1231 $elFromTable = $this->clipboard
->elFromTable('tt_content');
1232 if (!empty($elFromTable) && $this->getPageLayoutController()->pageIsNotLockedForEditors()) {
1233 $pasteItem = substr(key($elFromTable), 11);
1234 $pasteRecord = BackendUtility
::getRecord('tt_content', (int)$pasteItem);
1235 $pasteTitle = $pasteRecord['header'] ?
$pasteRecord['header'] : $pasteItem;
1236 $copyMode = $this->clipboard
->clipData
['normal']['mode'] ?
'-' . $this->clipboard
->clipData
['normal']['mode'] : '';
1237 $addExtOnReadyCode = '
1238 top.pasteIntoLinkTemplate = '
1239 . $this->tt_content_drawPasteIcon($pasteItem, $pasteTitle, $copyMode, 't3js-paste-into', 'pasteIntoColumn')
1241 top.pasteAfterLinkTemplate = '
1242 . $this->tt_content_drawPasteIcon($pasteItem, $pasteTitle, $copyMode, 't3js-paste-after', 'pasteAfterRecord')
1245 $addExtOnReadyCode = '
1246 top.pasteIntoLinkTemplate = \'\';
1247 top.pasteAfterLinkTemplate = \'\';';
1249 $pageRenderer = GeneralUtility
::makeInstance(PageRenderer
::class);
1250 $pageRenderer->addJsInlineCode('pasteLinkTemplates', $addExtOnReadyCode);
1251 // If language mode, then make another presentation:
1252 // Notice that THIS presentation will override the value of $out!
1253 // But it needs the code above to execute since $languageColumn is filled with content we need!
1254 if ($this->tt_contentConfig
['languageMode']) {
1255 // Get language selector:
1256 $languageSelector = $this->languageSelector($id);
1257 // Reset out - we will make new content here:
1259 // Traverse languages found on the page and build up the table displaying them side by side:
1262 foreach ($langListArr as $lP) {
1264 $labelClass = 'info';
1267 // Determine language mode
1268 if ($lP > 0 && isset($this->languageHasTranslationsCache
[$lP]['mode'])) {
1269 switch ($this->languageHasTranslationsCache
[$lP]['mode']) {
1271 $languageMode = $this->getLanguageService()->getLL('languageModeMixed');
1272 $labelClass = 'danger';
1275 $languageMode = $this->getLanguageService()->getLL('languageModeConnected');
1278 $languageMode = $this->getLanguageService()->getLL('languageModeFree');
1281 // we'll let opcode optimize this intentionally empty case
1285 <td valign="top" class="t3-page-column t3-page-column-lang-name" data-language-uid="' . $lP . '">
1286 <h2>' . htmlspecialchars($this->tt_contentConfig
['languageCols'][$lP]) . '</h2>
1287 ' . ($languageMode !== '' ?
'<span class="label label-' . $labelClass . '">' . $languageMode . '</span>' : '') . '
1290 // "View page" icon is added:
1292 if (!VersionState
::cast($this->getPageLayoutController()->pageinfo
['t3ver_state'])->equals(VersionState
::DELETE_PLACEHOLDER
)) {
1293 $onClick = BackendUtility
::viewOnClick($this->id
, '', BackendUtility
::BEgetRootLine($this->id
), '', '', ('&L=' . $lP));
1294 $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>';
1296 // Language overlay page header:
1298 $pageLocalizationRecord = BackendUtility
::getRecordLocalization('pages', $id, $lP);
1299 if (is_array($pageLocalizationRecord)) {
1300 $pageLocalizationRecord = reset($pageLocalizationRecord);
1302 BackendUtility
::workspaceOL('pages', $pageLocalizationRecord);
1303 $recordIcon = BackendUtility
::wrapClickMenuOnIcon(
1304 $this->iconFactory
->getIconForRecord('pages', $pageLocalizationRecord, Icon
::SIZE_SMALL
)->render(),
1306 $pageLocalizationRecord['uid']
1311 $pageLocalizationRecord['uid'] => 'edit'
1316 'sys_language_uid' => $lP
1319 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1321 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1322 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
1324 $this->getBackendUser()->check('tables_modify', 'pages')
1325 ?
'<a href="' . htmlspecialchars($url) . '" class="btn btn-default btn-sm"'
1326 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1327 . $this->iconFactory
->getIcon('actions-open', Icon
::SIZE_SMALL
)->render() . '</a>'
1332 '<div class="btn-group">'
1336 . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility
::fixed_lgd_cs($pageLocalizationRecord['title'], 20));
1340 if ($this->getBackendUser()->checkLanguageAccess(0)) {
1341 $recordIcon = BackendUtility
::wrapClickMenuOnIcon(
1342 $this->iconFactory
->getIconForRecord('pages', $this->pageRecord
, Icon
::SIZE_SMALL
)->render(),
1352 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1354 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1355 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
1357 $this->getBackendUser()->check('tables_modify', 'pages')
1358 ?
'<a href="' . htmlspecialchars($url) . '" class="btn btn-default btn-sm"'
1359 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1360 . $this->iconFactory
->getIcon('actions-open', Icon
::SIZE_SMALL
)->render() . '</a>'
1366 '<div class="btn-group">'
1370 . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility
::fixed_lgd_cs($this->pageRecord
['title'], 20));
1373 <td class="t3-page-column t3-page-lang-label nowrap">' . $lPLabel . '</td>';
1376 $out .= '<tr>' . implode($cCont) . '</tr>';
1377 $out .= '<tr>' . implode($sCont) . '</tr>';
1378 unset($cCont, $sCont);
1380 // Traverse previously built content for the columns:
1381 foreach ($languageColumn as $cKey => $cCont) {
1383 foreach ($cCont as $languageId => $columnContent) {
1384 $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>';
1387 if ($this->defLangBinding
) {
1388 // "defLangBinding" mode
1389 foreach ($defaultLanguageElementsByColumn[$cKey] as $defUid) {
1391 foreach ($langListArr as $lP) {
1392 $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . $this->newLanguageButton(
1393 $this->getNonTranslatedTTcontentUids([$defUid], $id, $lP),
1400 <td valign="top" class="t3-grid-cell">' . implode(('</td>' . '
1401 <td valign="top" class="t3-grid-cell">'), $cCont) . '</td>
1406 // Finally, wrap it all in a table and add the language selector on top of it:
1407 $out = $languageSelector . '
1408 <div class="t3-grid-container">
1409 <table cellpadding="0" cellspacing="0" class="t3-page-columns t3-grid-table t3js-page-columns">
1418 /**********************************
1420 * Generic listing of items
1422 **********************************/
1424 * Creates a standard list of elements from a table.
1426 * @param string $table Table name
1427 * @param int $id Page id.
1428 * @param string $fList Comma list of fields to display
1429 * @param bool $icon If TRUE, icon is shown
1430 * @param string $addWhere Additional WHERE-clauses.
1431 * @return string HTML table
1433 public function makeOrdinaryList($table, $id, $fList, $icon = false, $addWhere = '')
1436 $addWhere = empty($addWhere) ?
[] : [QueryHelper
::stripLogicalOperatorPrefix($addWhere)];
1437 $queryBuilder = $this->getQueryBuilder($table, $id, $addWhere);
1438 $this->setTotalItems($table, $id, $addWhere);
1441 // Make query for records if there were any records found in the count operation
1442 if ($this->totalItems
) {
1443 $result = $queryBuilder->execute();
1444 // Will return FALSE, if $result is invalid
1445 $dbCount = $result->rowCount();
1447 // If records were found, render the list
1453 $this->fieldArray
= GeneralUtility
::trimExplode(',', '__cmds__,' . $fList . ',__editIconLink__', true);
1455 $theData = $this->headerFields($this->fieldArray
, $table, $theData);
1457 $localizedTableTitle = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title']));
1458 $out .= '<tr><th class="col-icon"></th>'
1459 . '<th colspan="' . (count($theData) - 2) . '"><span class="c-table">'
1460 . $localizedTableTitle . '</span> (' . $dbCount . ')</td>' . '<td class="col-icon"></td>'
1463 if ($this->doEdit
) {
1470 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1472 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1473 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
1474 $title = htmlspecialchars($this->getLanguageService()->getLL('new'));
1475 $theData['__cmds__'] = '<a href="#" data-url="' . htmlspecialchars($url) . '" class="t3js-toggle-new-content-element-wizard" '
1476 . 'title="' . $title . '"'
1477 . 'data-title="' . $title . '">'
1478 . $this->iconFactory
->getIcon('actions-add', Icon
::SIZE_SMALL
)->render() . '</a>';
1480 $out .= $this->addElement(1, '', $theData, ' class="c-headLine"', 15, '', 'th');
1482 $this->eCounter
= $this->firstElementNumber
;
1483 while ($row = $result->fetch()) {
1484 BackendUtility
::workspaceOL($table, $row);
1485 if (is_array($row)) {
1486 list($flag, $code) = $this->fwd_rwd_nav();
1490 // Setting icons links
1492 $Nrow['__cmds__'] = $this->getIcon($table, $row);
1495 $Nrow = $this->dataFields($this->fieldArray
, $table, $row, $Nrow);
1497 if ($this->doEdit
&& $this->getBackendUser()->doesUserHaveAccess($this->pageinfo
, Permission
::CONTENT_EDIT
)) {
1501 $row['uid'] => 'edit'
1504 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1506 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1507 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
1508 $Nrow['__editIconLink__'] = '<a class="btn btn-default" href="' . htmlspecialchars($url)
1509 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1510 . $this->iconFactory
->getIcon('actions-open', Icon
::SIZE_SMALL
)->render() . '</a>';
1512 $Nrow['__editIconLink__'] = $this->noEditIcon();
1514 $out .= $this->addElement(1, '', $Nrow);
1519 // Wrap it all in a table:
1522 Standard list of table "' . $table . '"
1524 <div class="table-fit"><table class="table table-hover table-striped">
1531 * Adds content to all data fields in $out array
1533 * Each field name in $fieldArr has a special feature which is that the field name can be specified as more field names.
1534 * Eg. "field1,field2;field3".
1535 * Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.
1537 * @param array $fieldArr Array of fields to display
1538 * @param string $table Table name
1539 * @param array $row Record array
1540 * @param array $out Array to which the data is added
1541 * @return array $out array returned after processing.
1542 * @see makeOrdinaryList()
1544 public function dataFields($fieldArr, $table, $row, $out = [])
1546 // Check table validity
1547 if (!isset($GLOBALS['TCA'][$table])) {
1551 $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
1553 foreach ($fieldArr as $fieldName) {
1554 if ($GLOBALS['TCA'][$table]['columns'][$fieldName]) {
1555 // Each field has its own cell (if configured in TCA)
1556 // If the column is a thumbnail column:
1557 if ($fieldName == $thumbsCol) {
1558 $out[$fieldName] = $this->thumbCode($row, $table, $fieldName);
1560 // ... otherwise just render the output:
1561 $out[$fieldName] = nl2br(htmlspecialchars(trim(GeneralUtility
::fixed_lgd_cs(
1562 BackendUtility
::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']),
1567 // Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode
1568 // the field name with ";" and check each value there as a TCA configured field)
1569 $theFields = explode(';', $fieldName);
1570 // Traverse fields, separated by ";" (displayed in a single cell).
1571 foreach ($theFields as $fName2) {
1572 if ($GLOBALS['TCA'][$table]['columns'][$fName2]) {
1573 $out[$fieldName] .= '<strong>' . htmlspecialchars($this->getLanguageService()->sL(
1574 $GLOBALS['TCA'][$table]['columns'][$fName2]['label']
1575 )) . '</strong>' . ' ' . htmlspecialchars(GeneralUtility
::fixed_lgd_cs(
1576 BackendUtility
::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']),
1582 // If no value, add a nbsp.
1583 if (!$out[$fieldName]) {
1584 $out[$fieldName] = ' ';
1586 // Wrap in dimmed-span tags if record is "disabled"
1587 if ($this->isDisabled($table, $row)) {
1588 $out[$fieldName] = '<span class="text-muted">' . $out[$fieldName] . '</span>';
1595 * Header fields made for the listing of records
1597 * @param array $fieldArr Field names
1598 * @param string $table The table name
1599 * @param array $out Array to which the headers are added.
1600 * @return array $out returned after addition of the header fields.
1601 * @see makeOrdinaryList()
1603 public function headerFields($fieldArr, $table, $out = [])
1605 foreach ($fieldArr as $fieldName) {
1606 $ll = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['columns'][$fieldName]['label']));
1607 $out[$fieldName] = $ll ?
$ll : ' ';
1613 * Gets content records per column.
1614 * This is required for correct workspace overlays.
1616 * @param string $table UNUSED (will always be queried from tt_content)
1617 * @param int $id Page Id to be used (not used at all, but part of the API, see $this->pidSelect)
1618 * @param array $columns colPos values to be considered to be shown
1619 * @param string $additionalWhereClause Additional where clause for database select
1620 * @return array Associative array for each column (colPos)
1622 protected function getContentRecordsPerColumn($table, $id, array $columns, $additionalWhereClause = '')
1624 $contentRecordsPerColumn = array_fill_keys($columns, []);
1625 $columns = array_flip($columns);
1626 $queryBuilder = $this->getQueryBuilder(
1630 $additionalWhereClause
1634 // Traverse any selected elements and render their display code:
1635 $results = $this->getResult($queryBuilder->execute());
1637 $hookArray = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'] ??
[];
1638 foreach ($results as $record) {
1639 $used = isset($columns[$record['colPos']]);
1640 foreach ($hookArray as $_funcRef) {
1641 $_params = ['columns' => $columns, 'record' => $record, 'used' => $used];
1642 $used = GeneralUtility
::callUserFunction($_funcRef, $_params, $this);
1645 $columnValue = (string)$record['colPos'];
1646 $contentRecordsPerColumn[$columnValue][] = $record;
1648 $unused[] = $record;
1651 if (!empty($unused)) {
1652 $contentRecordsPerColumn['unused'] = $unused;
1654 return $contentRecordsPerColumn;
1657 /**********************************
1659 * Additional functions; Pages
1661 **********************************/
1664 * Adds pages-rows to an array, selecting recursively in the page tree.
1666 * @param int $pid Starting page id to select from
1667 * @param string $iconPrefix Prefix for icon code.
1668 * @param int $depth Depth (decreasing)
1669 * @param array $rows Array which will accumulate page rows
1670 * @return array $rows with added rows.
1672 protected function getPageRecordsRecursive(int $pid, int $depth, string $iconPrefix = '', array $rows = []): array
1675 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)->getQueryBuilderForTable('pages');
1676 $queryBuilder->getRestrictions()
1678 ->add(GeneralUtility
::makeInstance(DeletedRestriction
::class))
1679 ->add(GeneralUtility
::makeInstance(BackendWorkspaceRestriction
::class));
1685 $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO
::PARAM_INT
)),
1686 $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter(0, \PDO
::PARAM_INT
)),
1687 $this->getBackendUser()->getPagePermsClause(Permission
::PAGE_SHOW
)
1690 if (!empty($GLOBALS['TCA']['pages']['ctrl']['sortby'])) {
1691 $queryBuilder->orderBy($GLOBALS['TCA']['pages']['ctrl']['sortby']);
1695 $result = $queryBuilder->execute();
1696 $rowCount = $result->rowCount();
1698 while ($row = $result->fetch()) {
1699 BackendUtility
::workspaceOL('pages', $row);
1700 if (is_array($row)) {
1702 $row['treeIcons'] = $iconPrefix
1703 . '<span class="treeline-icon treeline-icon-join'
1704 . ($rowCount === $count ?
'bottom' : '')
1708 $spaceOutIcons = '<span class="treeline-icon treeline-icon-'
1709 . ($rowCount === $count ?
'clear' : 'line')
1711 $rows = $this->getPageRecordsRecursive(
1713 $row['php_tree_stop'] ?
0 : $depth,
1714 $iconPrefix . $spaceOutIcons,
1725 * Adds a list item for the pages-rendering
1727 * @param array $row Record array
1728 * @param array $fieldArr Field list
1729 * @return string HTML for the item
1731 public function pages_drawItem($row, $fieldArr)
1734 $theIcon = $this->getIcon('pages', $row);
1735 // Preparing and getting the data-array
1737 foreach ($fieldArr as $field) {
1740 $pTitle = htmlspecialchars(BackendUtility
::getProcessedValue('pages', $field, $row[$field], 20));
1741 $theData[$field] = $row['treeIcons'] . $theIcon . $pTitle;
1743 case 'php_tree_stop':
1744 // Intended fall through
1746 $theData[$field] = $row[$field] ?
'<strong>x</strong>' : ' ';
1749 if ($this->getBackendUser()->doesUserHaveAccess($row, 2) && $row['uid'] > 0) {
1753 $row['uid'] => 'edit'
1756 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
1758 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1759 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
1760 $onClick = BackendUtility
::viewOnClick($row['uid'], '', BackendUtility
::BEgetRootLine($row['uid']));
1763 '<a href="#" onclick="' . htmlspecialchars($onClick) . '" class="btn btn-default" title="' .
1764 $this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_viewPage') . '">' .
1765 $this->iconFactory
->getIcon('actions-view-page', Icon
::SIZE_SMALL
)->render() .
1768 '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" title="' .
1769 htmlspecialchars($this->getLanguageService()->getLL('editThisPage')) . '">' .
1770 $this->iconFactory
->getIcon('actions-page-open', Icon
::SIZE_SMALL
)->render() .
1775 $theData[$field] = '<div class="btn-group" role="group">' . $eI . '</div>';
1778 case 'shortcut_mode':
1779 if ((int)$row['doktype'] === \TYPO3\CMS\Frontend\Page\PageRepository
::DOKTYPE_SHORTCUT
) {
1780 $theData[$field] = $this->getPagesTableFieldValue($field, $row);
1784 if (substr($field, 0, 6) === 'table_') {
1785 $f2 = substr($field, 6);
1786 if ($GLOBALS['TCA'][$f2]) {
1787 $c = $this->numberOfRecords($f2, $row['uid']);
1788 $theData[$field] = ($c ?
$c : '');
1791 $theData[$field] = $this->getPagesTableFieldValue($field, $row);
1795 $this->addElement_tdParams
['title'] = $row['_CSSCLASS'] ?
' class="' . $row['_CSSCLASS'] . '"' : '';
1796 return $this->addElement(1, '', $theData);
1800 * Returns the HTML code for rendering a field in the pages table.
1801 * The row value is processed to a human readable form and the result is parsed through htmlspecialchars().
1803 * @param string $field The name of the field of which the value should be rendered.
1804 * @param array $row The pages table row as an associative array.
1805 * @return string The rendered table field value.
1807 protected function getPagesTableFieldValue($field, array $row)
1809 return htmlspecialchars(BackendUtility
::getProcessedValue('pages', $field, $row[$field]));
1812 /**********************************
1814 * Additional functions; Content Elements
1816 **********************************/
1818 * Draw header for a content element column:
1820 * @param string $colName Column name
1821 * @param string $editParams Edit params (Syntax: &edit[...] for FormEngine)
1822 * @return string HTML table
1824 public function tt_content_drawColHeader($colName, $editParams = '')
1827 // Create command links:
1828 if ($this->tt_contentConfig
['showCommands']) {
1829 // Edit whole of column:
1830 if ($editParams && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo
, Permission
::CONTENT_EDIT
) && $this->getBackendUser()->checkLanguageAccess(0)) {
1831 $iconsArr['edit'] = '<a href="#" onclick="'
1832 . htmlspecialchars(BackendUtility
::editOnClick($editParams)) . '" title="'
1833 . htmlspecialchars($this->getLanguageService()->getLL('editColumn')) . '">'
1834 . $this->iconFactory
->getIcon('actions-document-open', Icon
::SIZE_SMALL
)->render() . '</a>';
1838 if (!empty($iconsArr)) {
1839 $icons = '<div class="t3-page-column-header-icons">' . implode('', $iconsArr) . '</div>';
1841 // Create header row:
1842 $out = '<div class="t3-page-column-header">
1844 <div class="t3-page-column-header-label">' . htmlspecialchars($colName) . '</div>
1850 * Draw a paste icon either for pasting into a column or for pasting after a record
1852 * @param int $pasteItem ID of the item in the clipboard
1853 * @param string $pasteTitle Title for the JS modal
1854 * @param string $copyMode copy or cut
1855 * @param string $cssClass CSS class to determine if pasting is done into column or after record
1856 * @param string $title title attribute of the generated link
1858 * @return string Generated HTML code with link and icon
1860 protected function tt_content_drawPasteIcon($pasteItem, $pasteTitle, $copyMode, $cssClass, $title)
1862 $pasteIcon = json_encode(
1863 ' <a data-content="' . htmlspecialchars($pasteItem) . '"'
1864 . ' data-title="' . htmlspecialchars($pasteTitle) . '"'
1865 . ' class="t3js-paste t3js-paste' . htmlspecialchars($copyMode) . ' ' . htmlspecialchars($cssClass) . ' btn btn-default btn-sm"'
1866 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL($title)) . '">'
1867 . $this->iconFactory
->getIcon('actions-document-paste-into', Icon
::SIZE_SMALL
)->render()
1874 * Draw the footer for a single tt_content element
1876 * @param array $row Record array
1877 * @return string HTML of the footer
1878 * @throws \UnexpectedValueException
1880 protected function tt_content_drawFooter(array $row)
1883 // Get processed values:
1885 $this->getProcessedValue('tt_content', 'starttime,endtime,fe_group,space_before_class,space_after_class', $row, $info);
1887 // Content element annotation
1888 if (!empty($GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn'])) {
1889 $info[] = htmlspecialchars($row[$GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']]);
1892 // Call drawFooter hooks
1893 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'] ??
[] as $className) {
1894 $hookObject = GeneralUtility
::makeInstance($className);
1895 if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface
) {
1896 throw new \
UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface
::class, 1404378171);
1898 $hookObject->preProcess($this, $info, $row);
1901 // Display info from records fields:
1902 if (!empty($info)) {
1903 $content = '<div class="t3-page-ce-info">
1904 ' . implode('<br>', $info) . '
1908 if (!empty($content)) {
1909 $content = '<div class="t3-page-ce-footer">' . $content . '</div>';
1915 * Draw the header for a single tt_content element
1917 * @param array $row Record array
1918 * @param int $space Amount of pixel space above the header. UNUSED
1919 * @param bool $disableMoveAndNewButtons If set the buttons for creating new elements and moving up and down are not shown.
1920 * @param bool $langMode If set, we are in language mode and flags will be shown for languages
1921 * @param bool $dragDropEnabled If set the move button must be hidden
1922 * @return string HTML table with the record header.
1924 public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = false, $langMode = false, $dragDropEnabled = false)
1927 // If show info is set...;
1928 if ($this->tt_contentConfig
['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
1929 // Render control panel for the element:
1930 if ($this->tt_contentConfig
['showCommands'] && $this->doEdit
) {
1931 // Edit content element:
1935 $this->tt_contentData
['nextThree'][$row['uid']] => 'edit'
1938 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'],
1940 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
1941 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters) . '#element-tt_content-' . $row['uid'];
1943 $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url)
1944 . '" title="' . htmlspecialchars($this->nextThree
> 1
1945 ?
sprintf($this->getLanguageService()->getLL('nextThree'), $this->nextThree
)
1946 : $this->getLanguageService()->getLL('edit'))
1947 . '">' . $this->iconFactory
->getIcon('actions-open', Icon
::SIZE_SMALL
)->render() . '</a>';
1949 $hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
1950 if ($hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField]
1951 && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude']
1952 ||
$this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))
1954 if ($row[$hiddenField]) {
1961 $params = '&data[tt_content][' . ($row['_ORIG_uid'] ?
$row['_ORIG_uid'] : $row['uid'])
1962 . '][' . $hiddenField . ']=' . $value;
1963 $out .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility
::getLinkToDataHandlerAction($params))
1964 . '#element-tt_content-' . $row['uid'] . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($label)) . '">'
1965 . $this->iconFactory
->getIcon('actions-edit-' . strtolower($label), Icon
::SIZE_SMALL
)->render() . '</a>';
1968 $disableDeleteTS = $this->getBackendUser()->getTSConfig('options.disableDelete');
1969 $disableDelete = (bool)trim($disableDeleteTS['properties']['tt_content'] ??
$disableDeleteTS['value']);
1970 if (!$disableDelete) {
1971 $params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
1972 $confirm = $this->getLanguageService()->getLL('deleteWarning')
1973 . BackendUtility
::translationCount('tt_content', $row['uid'], (' '
1974 . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.translationsOfRecord')));
1975 $out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars(BackendUtility
::getLinkToDataHandlerAction($params)) . '"'
1976 . ' data-severity="warning"'
1977 . ' data-title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"'
1978 . ' data-content="' . htmlspecialchars($confirm) . '" '
1979 . ' data-button-close-text="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')) . '"'
1980 . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('deleteItem')) . '">'
1981 . $this->iconFactory
->getIcon('actions-edit-delete', Icon
::SIZE_SMALL
)->render() . '</a>';
1982 if ($out && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo
, Permission
::CONTENT_EDIT
)) {
1983 $out = '<div class="btn-group btn-group-sm" role="group">' . $out . '</div>';
1988 if (!$disableMoveAndNewButtons) {
1989 $moveButtonContent = '';
1990 $displayMoveButtons = false;
1992 if ($this->tt_contentData
['prev'][$row['uid']]) {
1993 $params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData
['prev'][$row['uid']];
1994 $moveButtonContent .= '<a class="btn btn-default" href="'
1995 . htmlspecialchars(BackendUtility
::getLinkToDataHandlerAction($params))
1996 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveUp')) . '">'
1997 . $this->iconFactory
->getIcon('actions-move-up', Icon
::SIZE_SMALL
)->render() . '</a>';
1998 if (!$dragDropEnabled) {
1999 $displayMoveButtons = true;
2002 $moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory
->getIcon('empty-empty', Icon
::SIZE_SMALL
)->render() . '</span>';
2004 // Move element down:
2005 if ($this->tt_contentData
['next'][$row['uid']]) {
2006 $params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData
['next'][$row['uid']];
2007 $moveButtonContent .= '<a class="btn btn-default" href="'
2008 . htmlspecialchars(BackendUtility
::getLinkToDataHandlerAction($params))
2009 . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveDown')) . '">'
2010 . $this->iconFactory
->getIcon('actions-move-down', Icon
::SIZE_SMALL
)->render() . '</a>';
2011 if (!$dragDropEnabled) {
2012 $displayMoveButtons = true;
2015 $moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory
->getIcon('empty-empty', Icon
::SIZE_SMALL
)->render() . '</span>';
2017 if ($displayMoveButtons) {
2018 $out .= '<div class="btn-group btn-group-sm" role="group">' . $moveButtonContent . '</div>';
2023 $allowDragAndDrop = $this->isDragAndDropAllowed($row);
2024 $additionalIcons = [];
2025 $additionalIcons[] = $this->getIcon('tt_content', $row) . ' ';
2026 $additionalIcons[] = $langMode ?
$this->languageFlag($row['sys_language_uid'], false) : '';
2027 // Get record locking status:
2028 if ($lockInfo = BackendUtility
::isRecordLocked('tt_content', $row['uid'])) {
2029 $additionalIcons[] = '<a href="#" data-toggle="tooltip" data-title="' . htmlspecialchars($lockInfo['msg']) . '">'
2030 . $this->iconFactory
->getIcon('warning-in-use', Icon
::SIZE_SMALL
)->render() . '</a>';
2032 // Call stats information hook
2033 $_params = ['tt_content', $row['uid'], &$row];
2034 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] ??
[] as $_funcRef) {
2035 $additionalIcons[] = GeneralUtility
::callUserFunction($_funcRef, $_params, $this);
2038 // Wrap the whole header
2039 // NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
2040 return '<div class="t3-page-ce-header ' . ($allowDragAndDrop ?
't3-page-ce-header-draggable t3js-page-ce-draghandle' : '') . '">
2041 <div class="t3-page-ce-header-icons-left">' . implode('', $additionalIcons) . '</div>
2042 <div class="t3-page-ce-header-icons-right">' . ($out ?
'<div class="btn-toolbar">' . $out . '</div>' : '') . '</div>
2044 <div class="t3-page-ce-body">';
2048 * Determine whether Drag & Drop should be allowed
2053 protected function isDragAndDropAllowed(array $row)
2055 if ((int)$row['l18n_parent'] === 0 &&
2057 $this->getBackendUser()->isAdmin()
2058 ||
((int)$row['editlock'] === 0 && (int)$this->pageinfo
['editlock'] === 0)
2059 && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo
, Permission
::CONTENT_EDIT
)
2060 && $this->getBackendUser()->checkAuthMode('tt_content', 'CType', $row['CType'], $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode'])
2069 * Draws the preview content for a content element
2071 * @param array $row Content element
2072 * @return string HTML
2073 * @throws \UnexpectedValueException
2075 public function tt_content_drawItem($row)
2081 if ($row['header']) {
2083 $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
2084 $hiddenHeaderNote = '';
2085 // If header layout is set to 'hidden', display an accordant note:
2086 if ($row['header_layout'] == 100) {
2087 $hiddenHeaderNote = ' <em>[' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.hidden')) . ']</em>';
2089 $outHeader = $row['date']
2090 ?
htmlspecialchars($this->itemLabels
['date'] . ' ' . BackendUtility
::date($row['date'])) . '<br />'
2092 $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row)
2093 . $hiddenHeaderNote . '</strong><br />';
2098 // Hook: Render an own preview of a record
2099 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'] ??
[] as $className) {
2100 $hookObject = GeneralUtility
::makeInstance($className);
2101 if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface
) {
2102 throw new \
UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawItemHookInterface
::class, 1218547409);
2104 $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
2107 // If the previous hook did not render something,
2108 // then check if a Fluid-based preview template was defined for this CType
2109 // and render it via Fluid. Possible option:
2110 // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html
2112 $tsConfig = BackendUtility
::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview');
2113 $fluidTemplateFile = '';
2116 $row['CType'] === 'list' && !empty($row['list_type'])
2117 && !empty($tsConfig['properties']['list.'][$row['list_type']])
2119 $fluidTemplateFile = $tsConfig['properties']['list.'][$row['list_type']];
2120 } elseif (!empty($tsConfig['properties'][$row['CType']])) {
2121 $fluidTemplateFile = $tsConfig['properties'][$row['CType']];
2124 if ($fluidTemplateFile) {
2125 $fluidTemplateFile = GeneralUtility
::getFileAbsFileName($fluidTemplateFile);
2126 if ($fluidTemplateFile) {
2128 /** @var StandaloneView $view */
2129 $view = GeneralUtility
::makeInstance(StandaloneView
::class);
2130 $view->setTemplatePathAndFilename($fluidTemplateFile);
2131 $view->assignMultiple($row);
2132 if (!empty($row['pi_flexform'])) {
2133 /** @var FlexFormService $flexFormService */
2134 $flexFormService = GeneralUtility
::makeInstance(FlexFormService
::class);
2135 $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));
2137 $out = $view->render();
2139 } catch (\Exception
$e) {
2140 // Catch any exception to avoid breaking the view
2146 // Draw preview of the item depending on its CType (if not disabled by previous hook):
2148 switch ($row['CType']) {
2150 if ($row['subheader']) {
2151 $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
2156 if ($row['bodytext']) {
2157 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
2161 if ($row['media']) {
2162 $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
2166 $contentType = $this->CType_labels
[$row['CType']];
2167 $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
2169 $menuTypeLabel = $this->getLanguageService()->sL(
2170 BackendUtility
::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type'])
2172 $menuTypeLabel = $menuTypeLabel ?
: 'invalid menu type';
2173 $out .= $this->linkEditContent($menuTypeLabel, $row);
2174 if ($row['menu_type'] !== '2' && ($row['pages'] ||
$row['selected_categories'])) {
2175 // Show pages if menu type is not "Sitemap"
2176 $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
2180 if (!empty($row['records'])) {
2181 $shortcutContent = [];
2182 $recordList = explode(',', $row['records']);
2183 foreach ($recordList as $recordIdentifier) {
2184 $split = BackendUtility
::splitTable_Uid($recordIdentifier);
2185 $tableName = empty($split[0]) ?
'tt_content' : $split[0];
2186 $shortcutRecord = BackendUtility
::getRecord($tableName, $split[1]);
2187 if (is_array($shortcutRecord)) {
2188 $icon = $this->iconFactory
->getIconForRecord($tableName, $shortcutRecord, Icon
::SIZE_SMALL
)->render();
2189 $icon = BackendUtility
::wrapClickMenuOnIcon(
2192 $shortcutRecord['uid']
2194 $shortcutContent[] = $icon
2195 . htmlspecialchars(BackendUtility
::getRecordTitle($tableName, $shortcutRecord));
2198 $out .= implode('<br />', $shortcutContent) . '<br />';
2203 $_params = ['pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr];
2205 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']] ??
2206 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'] ??
2209 $hookOut .= GeneralUtility
::callUserFunction($_funcRef, $_params, $this);
2211 if ((string)$hookOut !== '') {
2213 } elseif (!empty($row['list_type'])) {
2214 $label = BackendUtility
::getLabelFromItemListMerged($row['pid'], 'tt_content', 'list_type', $row['list_type']);
2215 if (!empty($label)) {
2216 $out .= $this->linkEditContent('<strong>' . htmlspecialchars($this->getLanguageService()->sL($label)) . '</strong>', $row) . '<br />';
2218 $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
2219 $out .= '<span class="label label-warning">' . htmlspecialchars($message) . '</span>';
2222 $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
2224 $out .= htmlspecialchars($this->getLanguageService()->sL(
2225 BackendUtility
::getLabelFromItemlist('tt_content', 'pages', $row['pages'])
2229 $contentType = $this->CType_labels
[$row['CType']];
2231 if (isset($contentType)) {
2232 $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
2233 if ($row['bodytext']) {
2234 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
2236 if ($row['image']) {
2237 $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row) . '<br />';
2241 $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'),
2244 $out .= '<span class="label label-warning">' . htmlspecialchars($message) . '</span>';
2250 <span class="exampleContent">' . $out . '</span>';
2252 $out = $outHeader . $out;
2254 if ($this->isDisabled('tt_content', $row)) {
2255 return '<span class="text-muted">' . $out . '</span>';
2261 * Generates a list of selected pages or categories for the CType menu
2263 * @param array $row row from pages
2266 protected function generateListForCTypeMenu(array $row)
2270 // get categories instead of pages
2271 if (strpos($row['menu_type'], 'categorized_') !== false) {
2272 $table = 'sys_category';
2273 $field = 'selected_categories';
2275 if (trim($row[$field]) === '') {
2279 $uidList = explode(',', $row[$field]);
2280 foreach ($uidList as $uid) {
2282 $record = BackendUtility
::getRecord($table, $uid, 'title');
2283 $content .= '<br>' . $record['title'] . ' (' . $uid . ')';
2289 * Filters out all tt_content uids which are already translated so only non-translated uids is left.
2290 * Selects across columns, but within in the same PID. Columns are expect to be the same
2291 * for translations and original but this may be a conceptual error (?)
2293 * @param array $defaultLanguageUids Numeric array with uids of tt_content elements in the default language
2294 * @param int $id Page pid
2295 * @param int $lP Sys language UID
2296 * @return array Modified $defLanguageCount
2298 public function getNonTranslatedTTcontentUids($defaultLanguageUids, $id, $lP)
2300 if ($lP && !empty($defaultLanguageUids)) {
2301 // Select all translations here:
2302 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)
2303 ->getQueryBuilderForTable('tt_content');
2304 $queryBuilder->getRestrictions()
2306 ->add(GeneralUtility
::makeInstance(DeletedRestriction
::class))
2307 ->add(GeneralUtility
::makeInstance(BackendWorkspaceRestriction
::class, null, false));
2310 ->from('tt_content')
2312 $queryBuilder->expr()->eq(
2314 $queryBuilder->createNamedParameter($lP, \PDO
::PARAM_INT
)
2316 $queryBuilder->expr()->in(
2318 $queryBuilder->createNamedParameter($defaultLanguageUids, Connection
::PARAM_INT_ARRAY
)
2322 $result = $queryBuilder->execute();
2325 $defaultLanguageUids = array_flip($defaultLanguageUids);
2326 // Traverse any selected elements and unset original UID if any:
2327 while ($row = $result->fetch()) {
2328 BackendUtility
::workspaceOL('tt_content', $row);
2329 unset($defaultLanguageUids[$row['l18n_parent']]);
2332 $defaultLanguageUids = array_keys($defaultLanguageUids);
2334 return $defaultLanguageUids;
2338 * Creates button which is used to create copies of records..
2340 * @param array $defaultLanguageUids Numeric array with uids of tt_content elements in the default language
2341 * @param int $lP Sys language UID
2342 * @param int $colPos Column position
2343 * @return string "Copy languages" button, if available.
2345 public function newLanguageButton($defaultLanguageUids, $lP, $colPos = 0)
2348 if (!$this->doEdit ||
!$lP) {
2353 $localizationTsConfig = BackendUtility
::getModTSconfig($this->id
, 'mod.web_layout.localization');
2354 $allowCopy = isset($localizationTsConfig['properties']['enableCopy'])
2355 ?
(int)$localizationTsConfig['properties']['enableCopy'] === 1
2357 $allowTranslate = isset($localizationTsConfig['properties']['enableTranslate'])
2358 ?
(int)$localizationTsConfig['properties']['enableTranslate'] === 1
2361 if (!empty($this->languageHasTranslationsCache
[$lP])) {
2362 if (isset($this->languageHasTranslationsCache
[$lP]['hasStandAloneContent'])) {
2363 $allowTranslate = false;
2365 if (isset($this->languageHasTranslationsCache
[$lP]['hasTranslations'])) {
2370 if (isset($this->contentElementCache
[$lP][$colPos]) && is_array($this->contentElementCache
[$lP][$colPos])) {
2371 foreach ($this->contentElementCache
[$lP][$colPos] as $record) {
2372 $key = array_search($record['l10n_source'], $defaultLanguageUids);
2373 if ($key !== false) {
2374 unset($defaultLanguageUids[$key]);
2379 if (!empty($defaultLanguageUids)) {
2382 . ' class="btn btn-default t3js-localize"'
2385 . ' value="' . htmlspecialchars($this->getLanguageService()->getLL('newPageContent_translate')) . '"'
2386 . ' data-has-elements="' . (int)!empty($this->contentElementCache
[$lP][$colPos]) . '"'
2387 . ' data-allow-copy="' . (int)$allowCopy . '"'
2388 . ' data-allow-translate="' . (int)$allowTranslate . '"'
2389 . ' data-table="tt_content"'
2390 . ' data-page-id="' . (int)GeneralUtility
::_GP('id') . '"'
2391 . ' data-language-id="' . $lP . '"'
2392 . ' data-language-name="' . htmlspecialchars($this->tt_contentConfig
['languageCols'][$lP]) . '"'
2393 . ' data-colpos-id="' . $colPos . '"'
2394 . ' data-colpos-name="' . BackendUtility
::getProcessedValue('tt_content', 'colPos', $colPos) . '"'
2398 return '<div class="t3-page-lang-copyce">' . $theNewButton . '</div>';
2402 * Creates onclick-attribute content for a new content element
2404 * @param int $id Page id where to create the element.
2405 * @param int $colPos Preset: Column position value
2406 * @param int $sys_language Preset: Sys langauge value
2407 * @return string String for onclick attribute.
2408 * @see getTable_tt_content()
2410 public function newContentElementOnClick($id, $colPos, $sys_language)
2412 if ($this->option_newWizard
) {
2413 $tsConfig = BackendUtility
::getModTSconfig($id, 'mod');
2414 $routeName = $tsConfig['properties']['newContentElementWizard.']['override']
2415 ??
'new_content_element_wizard';
2416 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
2417 $url = $uriBuilder->buildUriFromRoute($routeName, [
2419 'colPos' => $colPos,
2420 'sys_language_uid' => $sys_language,
2422 'returnUrl' => rawurlencode(GeneralUtility
::getIndpEnv('REQUEST_URI'))
2424 $onClick = 'window.location.href=' . GeneralUtility
::quoteJSvalue((string)$url) . ';';
2426 $onClick = BackendUtility
::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]='
2427 . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language);
2433 * Will create a link on the input string and possibly a big button after the string which links to editing in the RTE.
2434 * Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
2436 * @param string $str String to link. Must be prepared for HTML output.
2437 * @param array $row The row.
2438 * @return string If the whole thing was editable ($this->doEdit) $str is return with link around. Otherwise just $str.
2439 * @see getTable_tt_content()
2441 public function linkEditContent($str, $row)
2443 if ($this->doEdit
&& $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
2447 $row['uid'] => 'edit'
2450 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid']
2452 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
2453 $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
2455 return '<a href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">' . $str . '</a>';
2461 * Make selector box for creating new translation in a language
2462 * Displays only languages which are not yet present for the current page and
2463 * that are not disabled with page TS.
2465 * @param int $id Page id for which to create a new translation record of pages
2466 * @return string <select> HTML element (if there were items for the box anyways...)
2467 * @see getTable_tt_content()
2469 public function languageSelector($id)
2471 if ($this->getBackendUser()->check('tables_modify', 'pages')) {
2472 // First, select all
2473 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)->getQueryBuilderForTable('sys_language');
2474 $queryBuilder->getRestrictions()->removeAll();
2475 $queryBuilder->getRestrictions()->add(GeneralUtility
::makeInstance(HiddenRestriction
::class));
2476 $statement = $queryBuilder->select('uid', 'title')
2477 ->from('sys_language')
2478 ->orderBy('sorting')
2480 $availableTranslations = [];
2481 while ($row = $statement->fetch()) {
2482 if ($this->getBackendUser()->checkLanguageAccess($row['uid'])) {
2483 $availableTranslations[(int)$row['uid']] = $row['title'];
2486 // Then, subtract the languages which are already on the page:
2487 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)->getQueryBuilderForTable('sys_language');
2488 $queryBuilder->getRestrictions()->removeAll();
2489 $queryBuilder->select('sys_language.uid AS uid', 'sys_language.title AS title')
2490 ->from('sys_language')
2495 $queryBuilder->expr()->eq('sys_language.uid', $queryBuilder->quoteIdentifier('pages.' . $GLOBALS['TCA']['pages']['ctrl']['languageField']))
2498 $queryBuilder->expr()->eq(
2500 $queryBuilder->createNamedParameter(0, \PDO
::PARAM_INT
)
2502 $queryBuilder->expr()->eq(
2503 'pages.' . $GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'],
2504 $queryBuilder->createNamedParameter($this->id
, \PDO
::PARAM_INT
)
2506 $queryBuilder->expr()->orX(
2507 $queryBuilder->expr()->gte(
2508 'pages.t3ver_state',
2509 $queryBuilder->createNamedParameter(
2510 (string)new VersionState(VersionState
::DEFAULT_STATE
),
2514 $queryBuilder->expr()->eq(
2516 $queryBuilder->createNamedParameter($this->getBackendUser()->workspace
, \PDO
::PARAM_INT
)
2521 'pages.' . $GLOBALS['TCA']['pages']['ctrl']['languageField'],
2524 'sys_language.tstamp',
2525 'sys_language.hidden',
2526 'sys_language.title',
2527 'sys_language.language_isocode',
2528 'sys_language.static_lang_isocode',
2529 'sys_language.flag',
2530 'sys_language.sorting'
2532 ->orderBy('sys_language.sorting');
2533 if (!$this->getBackendUser()->isAdmin()) {
2534 $queryBuilder->andWhere(
2535 $queryBuilder->expr()->eq(
2536 'sys_language.hidden',
2537 $queryBuilder->createNamedParameter(0, \PDO
::PARAM_INT
)
2541 $statement = $queryBuilder->execute();
2542 while ($row = $statement->fetch()) {
2543 unset($availableTranslations[(int)$row['uid']]);
2545 // Remove disallowed languages
2546 if (!empty($availableTranslations)
2547 && !$this->getBackendUser()->isAdmin()
2548 && $this->getBackendUser()->groupData
['allowed_languages'] !== ''
2550 $allowed_languages = array_flip(explode(',', $this->getBackendUser()->groupData
['allowed_languages']));
2551 if (!empty($allowed_languages)) {
2552 foreach ($availableTranslations as $key => $value) {
2553 if (!isset($allowed_languages[$key]) && $key != 0) {
2554 unset($availableTranslations[$key]);
2559 // Remove disabled languages
2560 $modSharedTSconfig = BackendUtility
::getModTSconfig($id, 'mod.SHARED');
2561 $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages'])
2562 ? GeneralUtility
::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true)
2564 if (!empty($availableTranslations) && !empty($disableLanguages)) {
2565 foreach ($disableLanguages as $language) {
2566 if ($language != 0 && isset($availableTranslations[$language])) {
2567 unset($availableTranslations[$language]);
2571 // If any languages are left, make selector:
2572 if (!empty($availableTranslations)) {
2573 $output = '<option value="">' . htmlspecialchars($this->getLanguageService()->getLL('new_language')) . '</option>';
2574 foreach ($availableTranslations as $languageUid => $languageTitle) {
2575 // Build localize command URL to DataHandler (tce_db)
2576 // which redirects to FormEngine (record_edit)
2577 // which, when finished editing should return back to the current page (returnUrl)
2579 'justLocalized' => 'pages:' . $id . ':' . $languageUid,
2580 'returnUrl' => GeneralUtility
::getIndpEnv('REQUEST_URI')
2582 $uriBuilder = GeneralUtility
::makeInstance(UriBuilder
::class);
2583 $redirectUrl = (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters);
2584 $targetUrl = BackendUtility
::getLinkToDataHandlerAction(
2585 '&cmd[pages][' . $id . '][localize]=' . $languageUid,
2589 $output .= '<option value="' . htmlspecialchars($targetUrl) . '">' . htmlspecialchars($languageTitle) . '</option>';
2592 return '<div class="form-inline form-inline-spaced">'
2593 . '<div class="form-group">'
2594 . '<select class="form-control input-sm" name="createNewLanguage" onchange="window.location.href=this.options[this.selectedIndex].value">'
2596 . '</select></div></div>';
2603 * Traverse the result pointer given, adding each record to array and setting some internal values at the same time.
2605 * @param Statement $result DBAL Statement
2606 * @param string $table Table name defaulting to tt_content
2607 * @return array The selected rows returned in this array.
2609 public function getResult(Statement
$result, string $table = 'tt_content'): array
2612 // Traverse the result:
2613 while ($row = $result->fetch()) {
2614 BackendUtility
::workspaceOL($table, $row, -99, true);
2616 // Add the row to the array:
2620 $this->generateTtContentDataArray($output);
2621 // Return selected records
2625 /********************************
2627 * Various helper functions
2629 ********************************/
2632 * Initializes the clipboard for generating paste links
2635 * @see \TYPO3\CMS\Recordlist\RecordList::main()
2636 * @see \TYPO3\CMS\Backend\Controller\ContextMenuController::clipboardAction()
2637 * @see \TYPO3\CMS\Filelist\Controller\FileListController::indexAction()
2639 protected function initializeClipboard()
2642 $this->clipboard
= GeneralUtility
::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard
::class);
2644 // Initialize - reads the clipboard content from the user session
2645 $this->clipboard
->initializeClipboard();
2647 // This locks the clipboard to the Normal for this request.
2648 $this->clipboard
->lockToNormal();
2651 $this->clipboard
->cleanCurrent();
2653 // Save the clipboard content
2654 $this->clipboard
->endClipboard();
2658 * Generates the data for previous and next elements which is needed for movements.
2660 * @param array $rowArray
2662 protected function generateTtContentDataArray(array $rowArray)
2664 if (empty($this->tt_contentData
)) {
2665 $this->tt_contentData
= [
2671 foreach ($rowArray as $key => $value) {
2672 // Create the list of the next three ids (for editing links...)
2673 for ($i = 0; $i < $this->nextThree
; $i++
) {
2674 if (isset($rowArray[$key - $i])
2675 && !GeneralUtility
::inList($this->tt_contentData
['nextThree'][$rowArray[$key - $i]['uid']], $value['uid'])
2677 $this->tt_contentData
['nextThree'][$rowArray[$key - $i]['uid']] .= $value['uid'] . ',';
2681 // Create information for next and previous content elements
2682 if (isset($rowArray[$key - 1])) {
2683 if (isset($rowArray[$key - 2])) {
2684 $this->tt_contentData
['prev'][$value['uid']] = -$rowArray[$key - 2]['uid'];
2686 $this->tt_contentData
['prev'][$value['uid']] = $value['pid'];
2688 $this->tt_contentData
['next'][$rowArray[$key - 1]['uid']] = -$value['uid'];
2694 * Counts and returns the number of records on the page with $pid
2696 * @param string $table Table name
2697 * @param int $pid Page id
2698 * @return int Number of records.
2700 public function numberOfRecords($table, $pid)
2703 if ($GLOBALS['TCA'][$table]) {
2704 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)
2705 ->getQueryBuilderForTable($table);
2706 $queryBuilder->getRestrictions()
2708 ->add(GeneralUtility
::makeInstance(DeletedRestriction
::class))
2709 ->add(GeneralUtility
::makeInstance(BackendWorkspaceRestriction
::class));
2710 $count = (int)$queryBuilder->count('uid')
2713 $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO
::PARAM_INT
))
2723 * Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping etc.
2725 * @param string $input Input string
2726 * @return string Output string
2728 public function renderText($input)
2730 $input = strip_tags($input);
2731 $input = GeneralUtility
::fixed_lgd_cs($input, 1500);
2732 return nl2br(htmlspecialchars(trim($input), ENT_QUOTES
, 'UTF-8', false));
2736 * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu.
2738 * @param string $table Table name
2739 * @param array $row Record array
2740 * @param string $enabledClickMenuItems Passthrough to wrapClickMenuOnIcon
2741 * @return string HTML for the icon
2743 public function getIcon($table, $row, $enabledClickMenuItems = '')
2746 $toolTip = BackendUtility
::getRecordToolTip($row, 'tt_content');
2747 $icon = '<span ' . $toolTip . '>' . $this->iconFactory
->getIconForRecord($table, $row, Icon
::SIZE_SMALL
)->render() . '</span>';
2749 // The icon with link
2750 if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) {
2751 $icon = BackendUtility
::wrapClickMenuOnIcon($icon, $table, $row['uid']);
2757 * Creates processed values for all field names in $fieldList based on values from $row array.
2758 * The result is 'returned' through $info which is passed as a reference
2760 * @param string $table Table name
2761 * @param string $fieldList Comma separated list of fields.
2762 * @param array $row Record from which to take values for processing.
2763 * @param array $info Array to which the processed values are added.
2765 public function getProcessedValue($table, $fieldList, array $row, array &$info)
2767 // Splitting values from $fieldList
2768 $fieldArr = explode(',', $fieldList);
2769 // Traverse fields from $fieldList
2770 foreach ($fieldArr as $field) {
2772 $info[] = '<strong>' . htmlspecialchars($this->itemLabels
[$field]) . '</strong> '
2773 . htmlspecialchars(BackendUtility
::getProcessedValue($table, $field, $row[$field]));
2779 * Returns TRUE, if the record given as parameters is NOT visible based on hidden/starttime/endtime (if available)
2781 * @param string $table Tablename of table to test
2782 * @param array $row Record row.
2783 * @return bool Returns TRUE, if disabled.
2785 public function isDisabled($table, $row)
2787 $enableCols = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
2788 return $enableCols['disabled'] && $row[$enableCols['disabled']]
2789 ||
$enableCols['starttime'] && $row[$enableCols['starttime']] > $GLOBALS['EXEC_TIME']
2790 ||
$enableCols['endtime'] && $row[$enableCols['endtime']] && $row[$enableCols['endtime']] < $GLOBALS['EXEC_TIME'];
2794 * Returns icon for "no-edit" of a record.
2795 * Basically, the point is to signal that this record could have had an edit link if
2796 * the circumstances were right. A placeholder for the regular edit icon...
2798 * @param string $label Label key from LOCAL_LANG
2799 * @return string IMG tag for icon.
2801 public function noEditIcon($label = 'noEditItems')
2803 $title = htmlspecialchars($this->getLanguageService()->getLL($label));
2804 return '<span title="' . $title . '">' . $this->iconFactory
->getIcon('status-edit-read-only', Icon
::SIZE_SMALL
)->render() . '</span>';
2807 /*****************************************
2809 * External renderings
2811 *****************************************/
2814 * Creates a menu of the tables that can be listed by this function
2815 * Only tables which has records on the page will be included.
2816 * Notice: The function also fills in the internal variable $this->activeTables with icon/titles.
2818 * @param int $id Page id from which we are listing records (the function will look up if there are records on the page)
2819 * @return string HTML output.
2821 public function getTableMenu($id)
2824 $this->activeTables
= [];
2825 $theTables = ['tt_content'];
2827 if (is_array($this->externalTables
)) {
2828 $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables
)));
2831 // Traverse tables to check:
2832 foreach ($theTables as $tName) {
2833 // Check access and whether the proper extensions are loaded:
2834 if ($this->getBackendUser()->check('tables_select', $tName)
2836 isset($this->externalTables
[$tName])
2837 ||
$tName === 'fe_users' ||
$tName === 'tt_content'
2838 || \TYPO3\CMS\Core\Utility\ExtensionManagementUtility
::isLoaded($tName)
2841 // Make query to count records from page:
2842 $queryBuilder = GeneralUtility
::makeInstance(ConnectionPool
::class)
2843 ->getQueryBuilderForTable($tName);
2844 $queryBuilder->getRestrictions()
2846 ->add(GeneralUtility
::makeInstance(DeletedRestriction
::class))
2847 ->add(GeneralUtility
::makeInstance(BackendWorkspaceRestriction
::class));
2848 $count = $queryBuilder->count('uid')
2850 ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO
::PARAM_INT
)))
2853 // If records were found (or if "tt_content" is the table...):
2854 if ($count ||
$tName === 'tt_content') {
2857 <td><a href="#' . $tName . '" title="' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title'])) . '"></a>'
2858 . $this->iconFactory
->getIconForRecord($tName, [], Icon
::SIZE_SMALL
)->render()
2860 // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
2861 $title = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title']))
2862 . ': ' . $count . ' ' . htmlspecialchars($this->getLanguageService()->getLL('records'));
2863 $this->activeTables
[$tName] = '<span title="' . $title . '">'
2864 . $this->iconFactory
->getIconForRecord($tName, [], Icon
::SIZE_SMALL
)->render()