Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

[BUG] Generating with CONTENT, it get the content double #23

Open
wants to merge 109 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
21d1fb5
[TASK] Changed version number to distinguish between TER version
Bunnyfield Apr 22, 2016
767f0c0
Merge branch 'master' into 7-0
Bunnyfield Apr 22, 2016
9343ec4
Merge branch 'master' into 7-0
Bunnyfield Apr 22, 2016
779b99f
Merge branch 'master' into 7-0
Bunnyfield Apr 22, 2016
21bcc3e
Merge branch 'master' into 7-0
Bunnyfield Apr 23, 2016
dd4d230
Merge branch 'master' into 7-0
Bunnyfield May 17, 2016
1f0a1e8
Merge branch 'master' into 7-0
Bunnyfield May 18, 2016
cca52a3
Merge branch 'master' into 7-0
Bunnyfield May 24, 2016
87ffc6f
[BUGFIX] Fix composer.json for CMS 8
liayn Jul 12, 2016
d7c35a9
[BUGFIX] Fix various issues in DatabaseRecordList xclass
liayn Jul 12, 2016
340cdb5
[CLEANUP] Add missing use statements for phpdoc in DrawItem
liayn Jul 12, 2016
d3e3958
Revert "[BUGFIX] Fix composer.json for CMS 8"
Bunnyfield Jul 13, 2016
93aed80
[CLEANUP] Streamline code in DataHandler code
liayn Aug 5, 2016
803b68b
[CLEANUP] Backend
liayn Aug 5, 2016
18ab541
[CLEANUP] Plugin, Wizard and Xclass
liayn Aug 5, 2016
39dc564
[CLEANUP] Helper and Hooks
liayn Aug 5, 2016
fce4d9f
[BUGFIX] Exclude layouts are given as string not as array
Bunnyfield Aug 12, 2016
f7981e5
[BUGFIX] Empty variable must be defined as array
Bunnyfield Aug 12, 2016
ac38e95
[BUGFIX] Moved code back into if clause
Bunnyfield Aug 12, 2016
80b6df8
[BUGFIX] Second parameter of function call must be int not array
Bunnyfield Aug 12, 2016
d22f311
[BUGFIX] Parent can have difference class instances
Bunnyfield Aug 12, 2016
795723c
[TASK] Missing change of DatabaseRecordList
Bunnyfield Aug 15, 2016
20b124a
[BUGFIX] Correct container information directly while translating chi…
Bunnyfield Aug 19, 2016
4a8ab9b
[BUGFIX] copyFromAnotherPage sets clipboard copy mode
Bunnyfield Aug 19, 2016
4da7bcf
[TASK] replace deprecated language file paths in TCA
macjohnny Aug 2, 2016
a9c6926
[TASK] Support MySQL strict mode
Bunnyfield Sep 21, 2016
7902b68
[BUGFIX] Make pid of children identical to pid of parent container
Bunnyfield Aug 19, 2016
8d2808a
[BUGFIX] Add 0 as a possible value for grid columns in new CE wizard
Bunnyfield Sep 21, 2016
ab391cd
[BUGFIX] Set clipboard to copy mode for copy content from another pag…
Bunnyfield Sep 21, 2016
688631a
[BUGFIX] Check content not page permission before rendering grid columns
Bunnyfield Sep 21, 2016
198fdd8
[BUGFIX] Avoid phpstorm typoscript parsing error
simonschaufi Sep 23, 2016
fcb4dd8
[BUGFIX] Check for deleted records and don't assign 0 to GE fields
Bunnyfield Sep 24, 2016
7b1036b
[BUGFIX] Give child elements correct ID to jump back after editing
Bunnyfield Sep 24, 2016
109005d
[FEATURE] Allow svg as a file format for CE backend layout icons
Bunnyfield Sep 24, 2016
4ae33a6
[BUGFIX] Make elements droppable when only allowedGridTypes is set
Bunnyfield Aug 22, 2016
528c205
[BUGFIX] Assign container and grid column to new CE wizard default va…
Bunnyfield Oct 1, 2016
29ec99b
[BUGFIX] Assign correct ID to children of grid containers
Bunnyfield Oct 18, 2016
589c59b
[BUGFIX] Removed 100% width of outer table to avoid overlapping grids
Bunnyfield Nov 16, 2016
ef78aaa
[BUGFIX] Adjusted table width to avoid overlapping grids
Bunnyfield Nov 16, 2016
f0f4ee2
[BUGFIX] column table uses at least the whole available view port
Bunnyfield Nov 23, 2016
ff92952
[BUGFIX] Adjust CSS for frame-rendering
liayn Dec 22, 2016
3d8a705
[BUGFIX] Fix deprecated label usage
liayn Dec 22, 2016
93221db
[TASK] Prepared upload of version 7.1.0 for CMS 7 LTS
Bunnyfield Mar 13, 2017
2956eb8
[TASK] Adjusted composer.json
Bunnyfield Mar 13, 2017
0c83b1a
[TASK] Changelog points to Git repository
Bunnyfield Mar 13, 2017
d6d0177
[TASK] Implement latest changes of the core to list module XCLASS
Bunnyfield Mar 22, 2017
a60a8b5
[BUGFIX] Fix wrong condition for list module moveDown button
liayn Apr 6, 2017
10d123d
[BUGFIX] Check for possible XCLASS of original classes
Bunnyfield Apr 14, 2017
d46f4cb
[TASK] check for l18n_parent records before setting translated elements
Bunnyfield Apr 13, 2017
0ce0a05
[TASK] Use forge instead of git as the homepage wihtin composer.json
Bunnyfield Apr 14, 2017
2af838c
[BUGFIX] use largeIcon instead of icon for the check
Bunnyfield Apr 14, 2017
8ca7b88
[BUGFIX] Reenable horizontal positioning of child elements
Bunnyfield Apr 14, 2017
fb4bd92
[BUGFIX|] Use original tt_content_drawFooter method to generate footer
Bunnyfield Apr 14, 2017
59b9be5
[BUGFIX] Have Drag&Drop sorting respect AuthMode
Bunnyfield Apr 14, 2017
6f0e773
[TASK] Top align horizontally arranged children and remove line wrapping
Bunnyfield Apr 24, 2017
ee94d55
[TASK] Use post processing hook to add to TCA types after other ext
Bunnyfield Apr 25, 2017
b7db294
[BUGFIX] Make grid children sortable in list module again
Bunnyfield Apr 13, 2017
c439367
[BUGFIX] Don't convert relative path of icons anymore
Bunnyfield May 4, 2017
2bcb1ae
[TASK] Speed up the FE execution by using the TCA building slot
Bunnyfield May 16, 2017
a66c4c2
[BUGFIX] Skip empty values when merging layout setups
Bunnyfield Apr 25, 2017
f42b0af
[BUGFIX] Make paste as reference aware of shortcut restrictions
Bunnyfield May 30, 2017
8f62947
[BUGFIX] Assign proper visibility to stay compatible to PHP 7
Bunnyfield Jun 8, 2017
92a2b67
[BUGFIX] Empty remap stack and register DB list to avoid copying refe…
Bunnyfield Jun 15, 2017
baac7d5
[TASK] Adjust composer.json due to packagist error messages
Bunnyfield Jul 11, 2017
45df565
[TASK] Changed readme to contain branch specific information
Bunnyfield Jul 11, 2017
e013d8a
[BUGFIX] Use correct icon identifier for history icon
Bunnyfield Jul 14, 2017
82a00d2
[TASK] Adjust d&d classes to match current state of the core
Bunnyfield Jul 18, 2017
7041a33
[BUGFIX] Make sure the layout field for the CE is visible
liayn Aug 28, 2017
1308820
Make sure SOBE is page layout controller before using particular methods
Bunnyfield Dec 3, 2017
676b3ee
[BUGFIX] Adjust colspan of pagination cells to match colgroup columns
Bunnyfield Dec 16, 2017
5606cfb
[BUGFIX] Make sure to use both array and integer depending on context
Bunnyfield Dec 16, 2017
c2b2cc3
[BUGFIX] Respect containers with language set to "all"
Bunnyfield Dec 19, 2017
e949da6
[BUGFIX] Check for original container before trying to do container u…
Bunnyfield Dec 22, 2017
3b6cf41
[BUGFIX] Make sure allowed gridelements_pi1 works when set without gr…
Bunnyfield Dec 22, 2017
01786f5
[BUGFIX] fetch CType and gridType when dragging in elements via wizard
Bunnyfield Dec 22, 2017
bf59ee5
[TASK] Make sure that child elements of containers get correct colPos
Bunnyfield Dec 22, 2017
0a0f847
[TASK] Adjust documentaion and increase version number before release
Bunnyfield Dec 23, 2017
2750145
[TASK] Prepare maintenance release for issue 80838
Bunnyfield Dec 23, 2017
0d6f028
[TASK] Enable alphanumeric frame values for extension like t3ddy
Bunnyfield Dec 28, 2017
9edcd95
[BUGFIX] Adjust translations to match columns and container of l18n_p…
Bunnyfield Dec 28, 2017
68951d1
[BUGFIX] Remove trailing or leading comma from CSV list of columns
Bunnyfield Jan 9, 2018
b06152e
[TASK] Remove superfluous leading -2,-1, from CSV values
Bunnyfield Jan 10, 2018
6f1651e
[BUGFIX] Switch horizontal grids from inline-block to table-cell
Bunnyfield Jan 10, 2018
ccd28f1
[BUGFIX] Remove superfluous addCssFile calls in favor of TBE_STYLES
Bunnyfield Jan 10, 2018
2d6547c
[TASK] replace deprecated SPDX license identifier for packagist
Bunnyfield Jan 29, 2018
eb0f7ab
[BUGFIX] Check for NULL before accessing class to avoid errors w PHP 7.2
xperseguers Mar 1, 2018
4cfd6b8
[FEATURE] Restrict referenced content to column language if configured
Bunnyfield Mar 16, 2018
b4e22df
[BUGFIX] Use label for unassigned columns
Bunnyfield Mar 16, 2018
e63b18f
[BUGFIX] Fix shortcut rendering for shortcuts to page(s)
Bunnyfield Mar 19, 2018
7ffa726
[BUGFIX] Set proper CSS styles for neutral frame headers
Bunnyfield Mar 21, 2018
bb3c68b
[BUGFIX] Consider allowed settings for first level CE backend layouts
Bunnyfield Mar 21, 2018
95bf57f
[BUGFIX] Use proper palettes to get fields with CSC and FSC
Bunnyfield Mar 21, 2018
482a85c
[BUGFIX] use proper pid values to fetch available layout columns
Bunnyfield Mar 21, 2018
0be4d7b
[BUGFIX] convert negative uid values to pid before fetching BE layouts
Bunnyfield Mar 26, 2018
b31e023
[BUGFIX] remove hardcoded path from drag in wizard url
Bunnyfield Mar 31, 2018
8714b01
[BUGFIX] make paste icons aware of allowed and disallowed settings
Bunnyfield Apr 1, 2018
91a1197
[TASK] add sponsoring chapter to documentation
Bunnyfield Apr 1, 2018
52bb355
[TASK] Make Gridelements available for frontend editing
Bunnyfield Apr 3, 2018
9e51127
[TASK] Raise version numbers before releasing to TER
Bunnyfield Apr 3, 2018
978f8fe
[BUGFIX] initialize layout setups with negative uidPid value
Bunnyfield Apr 5, 2018
b9c88a3
[BUGFIX] Make sure values are integers for strict comparison
Bunnyfield May 3, 2018
848042e
[BUGFIX] Get default language only when sys_language_content is not set
Bunnyfield May 3, 2018
8b430f5
[TASK] Raise version numbers before releasin to TER
Bunnyfield Jun 18, 2018
46b6c0c
[BUGFIX] Fetch children of translated containers regardless of l18n_p…
Bunnyfield Jun 18, 2018
2937923
[TASK] Raise version number before releasing to TER
Bunnyfield Jun 18, 2018
ff416b6
[TASK] Add dependencies to make sure those are loaded before GE
Bunnyfield Jun 25, 2018
3f00233
[BUGFIX] Introduce contentUid for DataHandler hooks
Bunnyfield Jul 9, 2018
b256d4f
[BUGFIX] Core might provide strings as dataStructureArray too
Bunnyfield Aug 13, 2018
a53b288
[TASK] Remove superfluous plugin configuration
Bunnyfield Jan 1, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
7.1.0 > See https://forge.typo3.org/projects/extension-gridelements2/repository/show?rev=7-0

7.0.5 > 2016-01-29 Jo Hasenau <info@cybercraft.de>
Done: Task #60220 Escaped variables in SQL queries
Added: Feature #47294 Make PAGE_TSCONFIG_ID aware of CSV lists of IDs
Expand Down
82 changes: 40 additions & 42 deletions Classes/Backend/ClickMenuOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
*/
class ClickMenuOptions implements SingletonInterface
{

/**
* @var LanguageService
*/
Expand All @@ -51,41 +50,36 @@ class ClickMenuOptions implements SingletonInterface
/**
* Main method
*
* @param CLickMenu $backRef
* @param ClickMenu $backRef
* @param array $menuItems
* @param string $table
* @param int $uid
*
* @return array
*/
public function main($backRef, array $menuItems, $table = '', $uid = 0)
public function main(ClickMenu $backRef, array $menuItems, $table = '', $uid = 0)
{
if ($table !== 'tt_content') {
return $menuItems;
}

if ($table === 'tt_content') {
$this->setLanguageService($GLOBALS['LANG']);
$this->setLanguageService($GLOBALS['LANG']);

// add "paste reference after" if user is allowed to use CType shortcut
if ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode'])) {
if ($menuItems['pasteafter']) {
unset($menuItems['pasteafter']);
$selItem = $backRef->clipObj->getSelectedRecord();
$targetItem = BackendUtility::getRecordRaw('tt_content', 'uid = ' . $uid,
'colPos,tx_gridelements_container,tx_gridelements_columns');
$elInfo = array(
GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'],
$this->getBackendUser()->uc['titleLen']),
$backRef->root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table,
$backRef->rec), $this->getBackendUser()->uc['titleLen']),
$backRef->clipObj->currentMode()
);
$menuItems['pasteafter'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem,
false);
if ($backRef->clipObj->currentMode() === 'copy') {
$menuItems['pastereference'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo,
$targetItem, true);
}
}
// add "paste reference after" if user is allowed to use CType shortcut
if ($menuItems['pasteafter'] && $this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode'])) {
unset($menuItems['pasteafter']);
$selItem = $backRef->clipObj->getSelectedRecord();
$targetItem = BackendUtility::getRecordRaw('tt_content', 'uid = ' . $uid, 'colPos,tx_gridelements_container,tx_gridelements_columns');
$elInfo = array(
GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $this->getBackendUser()->uc['titleLen']),
GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $backRef->rec), $this->getBackendUser()->uc['titleLen']),
$backRef->clipObj->currentMode()
);
$menuItems['pasteafter'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, false);
if ($backRef->clipObj->currentMode() === 'copy') {
$menuItems['pastereference'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, true);
}

}

return $menuItems;
Expand All @@ -95,42 +89,49 @@ public function main($backRef, array $menuItems, $table = '', $uid = 0)
* Adding CM element for Clipboard "paste into"/"paste after"
* NOTICE: $table and $uid should follow the special syntax for paste, see clipboard-class :: pasteUrl();
*
* @param CLickMenu $backRef
* @param ClickMenu $backRef
* @param string $table Table name
* @param int $uid UID for the current record. NOTICE: Special syntax!
* @param string $type Type: "into" or "after
* @param string $type Type "into" or "after
* @param array $elInfo Contains instructions about whether to copy or cut an element.
* @param array $targetItem
* @param bool $reference
*
* @return array Item array, element in $menuItems
*/
public function DB_paste(&$backRef, $table, $uid, $type, $elInfo, $targetItem, $reference)
public function DB_paste(ClickMenu $backRef, $table, $uid, $type, array $elInfo, array $targetItem, $reference)
{
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$updateArray = array(
'colPos' => $targetItem['colPos'],
'tx_gridelements_container' => $targetItem['tx_gridelements_container'],
'tx_gridelements_columns' => $targetItem['tx_gridelements_columns']
'tx_gridelements_container' => (int)$targetItem['tx_gridelements_container'],
'tx_gridelements_columns' => (int)$targetItem['tx_gridelements_columns']
);
$loc = 'top.content.list_frame';
if ($this->getBackendUser()->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE)) {
$conf = $loc . ' && confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL(('LLL:EXT:lang/locallang_core.xlf:mess.' . ($elInfo[2] === 'copy' ? 'copy' : 'move') . '_' . $type)),
$elInfo[0], $elInfo[1])) . ')';
$conf = $loc . ' && confirm(' . GeneralUtility::quoteJSvalue(
sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.' . ($elInfo[2] === 'copy' ? 'copy' : 'move') . '_' . $type), $elInfo[0], $elInfo[1])
) . ')';
} else {
$conf = $loc;
}
$editOnClick = 'if(' . $conf . '){' . $loc . '.location.href=' . GeneralUtility::quoteJSvalue($backRef->clipObj->pasteUrl($table,
$uid, 0,
$updateArray) . ($reference ? '&reference=1' : '') . '&redirect=') . '+top.rawurlencode(' . $backRef->frameLocation(($loc . '.document')) . '.pathname+' . $backRef->frameLocation(($loc . '.document')) . '.search);}';
$editOnClick = 'if(' . $conf . '){' . $loc . '.location.href='
. GeneralUtility::quoteJSvalue($backRef->clipObj->pasteUrl($table, $uid, 0, $updateArray)
. ($reference ? '&reference=1' : '') . '&redirect=') . '+top.rawurlencode('
. $backRef->frameLocation(($loc . '.document')) . '.pathname+'
. $backRef->frameLocation(($loc . '.document')) . '.search);}';

return $backRef->linkItem($reference ? $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_clickmenu_pastereference') : $backRef->label('paste' . $type),
return $backRef->linkItem(
$reference
? $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_ClickMenu_pastereference')
: $backRef->label('paste' . $type),
$this->iconFactory->getIcon('actions-document-paste-' . $type, Icon::SIZE_SMALL)->render(),
$editOnClick . 'return false;');
$editOnClick . 'return false;'
);
}

/**
* Gets the current backend user.
* Gets the current backend user
*
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
*/
Expand All @@ -153,12 +154,9 @@ public function getLanguageService()
* setter for databaseConnection object
*
* @param LanguageService $languageService
*
* @return void
*/
public function setLanguageService(LanguageService $languageService)
{
$this->languageService = $languageService;
}

}
35 changes: 5 additions & 30 deletions Classes/Backend/ItemsProcFuncs/AbstractItemsProcFunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use GridElementsTeam\Gridelements\Helper\Helper;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Database\QueryGenerator;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;

/**
Expand All @@ -36,7 +36,6 @@
*/
abstract class AbstractItemsProcFunc implements SingletonInterface
{

/**
* @var DatabaseConnection
*/
Expand All @@ -52,11 +51,6 @@ abstract class AbstractItemsProcFunc implements SingletonInterface
*/
protected $tree;

/**
* @var string
*/
protected $backPath = '';

/**
* initializes this class
*
Expand All @@ -71,38 +65,19 @@ public function init($pageUid = 0)
/**
* Gets the selected backend layout
*
* @param int $id : The uid of the page we are currently working on
* @param int $id The uid of the page we are currently working on
*
* @return array|null $backendLayout : An array containing the data of the selected backend layout as well as a parsed version of the layout configuration
* @return array|null An array containing the data of the selected backend layout as well as a parsed version of the layout configuration
*/
public function getSelectedBackendLayout($id)
{
$backendLayoutData = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout',
$id, $this);
// add allowed CTypes to the columns, since this is not done by the native core methods
if (count($backendLayoutData['__items']) > 0) {
if (!empty($backendLayoutData['__config']['backend_layout.']['rows.'])) {
foreach ($backendLayoutData['__config']['backend_layout.']['rows.'] as $row) {
if (!empty($row['columns.'])) {
foreach ($row['columns.'] as $column) {
$backendLayoutData['columns'][$column['colPos']] = $column['allowed'] ? $column['allowed'] : '*';
$backendLayoutData['columns']['allowed'] .= $backendLayoutData['columns']['allowed'] ? ',' . $backendLayoutData['columns'][$column['colPos']] : $backendLayoutData['columns'][$column['colPos']];
}
}
}
}
foreach ($backendLayoutData['__items'] as $key => $item) {
$backendLayoutData['__items'][$key][3] = $backendLayoutData['columns'][$item[1]];
}
};

return $backendLayoutData;
return Helper::getInstance()->getSelectedBackendLayout($id);
}

/**
* This method is a wrapper for unitTests because of the static method
*
* @param $pageUid
* @param int $pageUid
*
* @return array
*/
Expand Down
68 changes: 28 additions & 40 deletions Classes/Backend/ItemsProcFuncs/CTypeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
***************************************************************/

use GridElementsTeam\Gridelements\Backend\LayoutSetup;
use GridElementsTeam\Gridelements\Helper\Helper;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand All @@ -46,84 +46,72 @@ class CTypeList extends AbstractItemsProcFunc
/**
* injects layout setup
*
* @param \GridElementsTeam\Gridelements\Backend\LayoutSetup $layoutSetup
* @param LayoutSetup $layoutSetup
*/
public function injectLayoutSetup(LayoutSetup $layoutSetup)
{
$this->layoutSetup = $layoutSetup;
}

/**
* ItemProcFunc for CType items
* initializes this class
*
* @param array $params : The array of parameters that is used to render the item list
* @param int $pageUid
*/
public function init($pageUid = 0)
{
parent::init();
if (!$this->layoutSetup) {
$this->injectLayoutSetup(GeneralUtility::makeInstance(LayoutSetup::class)->init($pageUid));
}
}

/**
* ItemProcFunc for CType items
*
* @return void
* @param array $params The array of parameters that is used to render the item list
*/
public function itemsProcFunc(&$params)
public function itemsProcFunc(array &$params)
{
if ((int)$params['row']['pid'] > 0) {
$this->checkForAllowedCTypes($params['items'], $params['row']['pid'], $params['row']['colPos'],
$params['row']['tx_gridelements_container'], $params['row']['tx_gridelements_columns']);
$this->checkForAllowedCTypes($params['items'], $params['row']['pid'], $params['row']['colPos'], $params['row']['tx_gridelements_container'], $params['row']['tx_gridelements_columns']);
} else {
$this->init((int)$params['row']['pid']);
// negative uid_pid values indicate that the element has been inserted after an existing element
// so there is no pid to get the backendLayout for and we have to get that first
$existingElement = $this->databaseConnection->exec_SELECTgetSingleRow('pid, CType, colPos, tx_gridelements_container, tx_gridelements_columns',
'tt_content', 'uid=' . -((int)$params['row']['pid']));
$existingElement = $this->databaseConnection->exec_SELECTgetSingleRow('pid, CType, colPos, tx_gridelements_container, tx_gridelements_columns', 'tt_content', 'uid=' . -((int)$params['row']['pid']));
if ((int)$existingElement['pid'] > 0) {
$this->checkForAllowedCTypes($params['items'], $existingElement['pid'], $existingElement['colPos'],
$existingElement['tx_gridelements_container'], $existingElement['tx_gridelements_columns']);
$this->checkForAllowedCTypes($params['items'], $existingElement['pid'], $existingElement['colPos'], $existingElement['tx_gridelements_container'], $existingElement['tx_gridelements_columns']);
}
}
}

/**
* Checks if a CType is allowed in this particular page or grid column - only this one column defines the allowed CTypes regardless of any parent column
*
* @param array $items : The items of the current CType list
* @param integer $pid : The id of the page we are currhently working on
* @param integer $pageColumn : The page column the element is a child of
* @param integer $gridContainerId : The ID of the current container
* @param integer $gridColumn : The grid column the element is a child of
*
* @return array|null $backendLayout: An array containing the data of the selected backend layout as well as a parsed version of the layout configuration
* @param array $items The items of the current CType list
* @param int $pid The id of the page we are currently working on
* @param int $pageColumn The page column the element is a child of
* @param int $gridContainerId The ID of the current container
* @param int $gridColumn The grid column the element is a child of
*/
public function checkForAllowedCTypes(&$items, $pid, $pageColumn, $gridContainerId, $gridColumn)
public function checkForAllowedCTypes(array &$items, $pid, $pageColumn, $gridContainerId, $gridColumn)
{
if ((int)$pageColumn >= 0 || (int)$pageColumn === -2) {
$column = $pageColumn ? $pageColumn : 0;
$backendLayout = $this->getSelectedBackendLayout($pid);
} else {
$this->init($pid);
$column = $gridColumn ? $gridColumn : 0;
$column = $gridColumn ? (int)$gridColumn : 0;
$gridElement = $this->layoutSetup->cacheCurrentParent($gridContainerId, true);
$backendLayout = $this->layoutSetup->getLayoutSetup($gridElement['tx_gridelements_backend_layout']);
}
if (isset($backendLayout)) {
foreach ($items as $key => $item) {
if (!(GeneralUtility::inList($backendLayout['columns'][$column],
$item[1]) || GeneralUtility::inList($backendLayout['columns'][$column], '*'))
) {
if (!GeneralUtility::inList($backendLayout['columns'][$column], $item[1]) && !GeneralUtility::inList($backendLayout['columns'][$column], '*')) {
unset($items[$key]);
}
}
}
}

/**
* initializes this class
*
* @param int $pageUid
*/
public function init($pageUid = 0)
{
parent::init();
if (!$this->layoutSetup instanceof LayoutSetup) {
if ($pageUid < 0) {
$pageUid = Helper::getInstance()->getPidFromNegativeUid($pageUid);
}
$this->injectLayoutSetup(GeneralUtility::makeInstance(LayoutSetup::class)->init($pageUid));
}
}
}
Loading