Commit ee4fa1e4 authored by crell's avatar crell Committed by Benni Mack
Browse files

[TASK] Resolve more PHP 8 acceptance tests

More array type mishandling correction.

Resolves: #94057
Releases: master
Change-Id: If1dbb57028c327ac64e228970f21d6546082fb1d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69152

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 652bae7a
......@@ -600,11 +600,11 @@ class ShortcutRepository
$selectFields[] = 'doktype';
}
if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'] ?? null)) {
$selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
}
if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column'] ?? null) {
$selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
}
......@@ -642,9 +642,9 @@ class ShortcutRepository
if (strpos($moduleName, '_') !== false) {
[$mainModule, $subModule] = explode('_', $moduleName, 2);
$iconIdentifier = $this->moduleLoader->modules[$mainModule]['sub'][$subModule]['iconIdentifier'];
$iconIdentifier = $this->moduleLoader->modules[$mainModule]['sub'][$subModule]['iconIdentifier'] ?? '';
} elseif ($moduleName !== '') {
$iconIdentifier = $this->moduleLoader->modules[$moduleName]['iconIdentifier'];
$iconIdentifier = $this->moduleLoader->modules[$moduleName]['iconIdentifier'] ?? '';
}
if (!$iconIdentifier) {
......
......@@ -39,7 +39,7 @@ class UserFunctions
'%s %s [%d] (%s) Base: %s',
$record['enabled'] ? '' : '[' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:disabled') . ']',
$record['title'],
$record['languageId'][0],
(int)($record['languageId'][0] ?? 0),
$record['locale'],
$record['base']
);
......
......@@ -477,7 +477,7 @@ class NewContentElementController
// Traverse wizard items:
foreach ($wizardItems as $key => $cfg) {
// Exploding parameter string, if any (old style)
if ($wizardItems[$key]['params']) {
if ($wizardItems[$key]['params'] ?? false) {
// Explode GET vars recursively
$tempGetVars = [];
parse_str($wizardItems[$key]['params'], $tempGetVars);
......@@ -494,9 +494,10 @@ class NewContentElementController
}
}
// If tt_content_defValues are defined...:
if (is_array($wizardItems[$key]['tt_content_defValues'])) {
if (is_array($wizardItems[$key]['tt_content_defValues'] ?? false)) {
$backendUser = $this->getBackendUser();
// Traverse field values:
$wizardItems[$key]['params'] ??= '';
foreach ($wizardItems[$key]['tt_content_defValues'] as $fN => $fV) {
if (is_array($GLOBALS['TCA']['tt_content']['columns'][$fN])) {
// Get information about if the field value is OK:
......@@ -535,7 +536,7 @@ class NewContentElementController
// remove headers without elements
foreach ($wizardItems as $key => $cfg) {
$tmp = explode('_', $key);
if ($tmp[0] && !$tmp[1] && !in_array($tmp[0], $headersUsed)) {
if (($tmp[0] ?? null) && !($tmp[1] ?? null) && !in_array($tmp[0], $headersUsed)) {
unset($wizardItems[$key]);
}
}
......
......@@ -583,7 +583,7 @@ class EditDocumentController
foreach ($keys as $key) {
$editId = $tce->substNEWwithIDs[$key];
// Check if the $editId isn't a child record of an IRRE action
if (!(is_array($tce->newRelatedIDs[$tableName])
if (!(is_array($tce->newRelatedIDs[$tableName] ?? null)
&& in_array($editId, $tce->newRelatedIDs[$tableName]))
) {
// Translate new id to the workspace version
......@@ -994,7 +994,7 @@ class EditDocumentController
if ($editForm) {
$this->firstEl = reset($this->elementsData);
// Checking if the currently open document is stored in the list of "open documents" - if not, add it:
if (($this->docDat[1] !== $this->storeUrlMd5 || !isset($this->docHandler[$this->storeUrlMd5]))
if ((($this->docDat[1] ?? null) !== $this->storeUrlMd5 || !isset($this->docHandler[$this->storeUrlMd5]))
&& !$this->dontStoreDocumentRef
) {
$this->docHandler[$this->storeUrlMd5] = [
......@@ -1306,7 +1306,7 @@ class EditDocumentController
protected function isInconsistentLanguageHandlingAllowed(): bool
{
$allowInconsistentLanguageHandling = BackendUtility::getPagesTSconfig(
$this->pageinfo['uid']
$this->pageinfo['uid'] ?? 0
)['mod']['web_layout']['allowInconsistentLanguageHandling'] ?? ['value' => '0'];
return $allowInconsistentLanguageHandling['value'] === '1';
......@@ -1323,14 +1323,14 @@ class EditDocumentController
if ($this->firstEl['table'] === 'tt_content') {
if (!$this->isSavedRecord) {
$this->isPageInFreeTranslationMode = $this->getFreeTranslationMode(
(int)$this->pageinfo['uid'],
(int)$this->defVals['colPos'],
(int)($this->pageinfo['uid'] ?? 0),
(int)($this->defVals['colPos'] ?? 0),
$sysLanguageUid
);
} else {
$this->isPageInFreeTranslationMode = $this->getFreeTranslationMode(
(int)$this->pageinfo['uid'],
(int)$record['colPos'],
(int)($this->pageinfo['uid'] ?? 0),
(int)($record['colPos'] ?? 0),
$sysLanguageUid
);
}
......@@ -2003,8 +2003,8 @@ class EditDocumentController
protected function languageSwitch(string $table, int $uid, $pid = null)
{
$backendUser = $this->getBackendUser();
$languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
$transOrigPointerField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
$languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'] ?? '';
$transOrigPointerField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] ?? '';
// Table editable and activated for languages?
if ($backendUser->check('tables_modify', $table)
&& $languageField
......
......@@ -73,7 +73,7 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
// Child, a record from this table should be rendered
$child = $inlineStackProcessor->getUnstableStructure();
if (MathUtility::canBeInterpretedAsInteger($child['uid'])) {
if (isset($child['uid']) && MathUtility::canBeInterpretedAsInteger($child['uid'])) {
// If uid comes in, it is the id of the record neighbor record "create after"
$childVanillaUid = -1 * abs((int)$child['uid']);
} else {
......@@ -107,7 +107,7 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
}
$childData = $formDataCompiler->compile($formDataCompilerInput);
if ($parentConfig['foreign_selector'] && $parentConfig['appearance']['useCombination']) {
if (($parentConfig['foreign_selector'] ?? false) && ($parentConfig['appearance']['useCombination'] ?? false)) {
// We have a foreign_selector. So, we just created a new record on an intermediate table in $childData.
// Now, if a valid id is given as second ajax parameter, the intermediate row should be connected to an
// existing record of the child-child table specified by the given uid. If there is no such id, user
......
......@@ -46,7 +46,7 @@ class LogoutController
{
$this->processLogout();
$redirectUrl = $request->getParsedBody()['redirect'] ?? $request->getQueryParams()['redirect'];
$redirectUrl = $request->getParsedBody()['redirect'] ?? $request->getQueryParams()['redirect'] ?? '';
$redirectUrl = GeneralUtility::sanitizeLocalUrl($redirectUrl);
if (empty($redirectUrl)) {
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
......
......@@ -568,10 +568,11 @@ class NewRecordController
. '</ul>';
} else {
// Get the title
if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) {
continue;
}
if ($v['ctrl']['adminOnly'] && !$isAdmin) {
if (($v['ctrl']['readOnly'] ?? false)
|| ($v['ctrl']['hideTable'] ?? false)
|| ($v['ctrl']['is_static'] ?? false)
|| (($v['ctrl']['adminOnly'] ?? false) && !$isAdmin)
) {
continue;
}
$nameParts = explode('_', $table);
......@@ -725,15 +726,10 @@ class NewRecordController
}
// Checking doktype:
$doktype = (int)$page['doktype'];
if (!($allowedTableList = $GLOBALS['PAGES_TYPES'][$doktype]['allowedTables'])) {
$allowedTableList = $GLOBALS['PAGES_TYPES']['default']['allowedTables'];
}
$allowedTableList = $GLOBALS['PAGES_TYPES'][$doktype]['allowedTables'] ?? $GLOBALS['PAGES_TYPES']['default']['allowedTables'] ?? '';
// If all tables or the table is listed as an allowed type, return TRUE
if (strpos($allowedTableList, '*') !== false || GeneralUtility::inList($allowedTableList, $table)) {
return true;
}
return false;
return strpos($allowedTableList, '*') !== false || GeneralUtility::inList($allowedTableList, $table);
}
/**
......
......@@ -41,7 +41,7 @@ abstract class AbstractNode implements NodeInterface, LoggerAwareInterface
*
* @var array
*/
protected $data = [];
protected array $data = [];
/**
* A list of default field information added to the element / container.
......
......@@ -180,7 +180,7 @@ class InlineControlContainer extends AbstractContainer
$this->inlineData['config'][$nameObject . '-' . $foreign_table] = [
'min' => $config['minitems'],
'max' => $config['maxitems'],
'sortable' => $config['appearance']['useSortable'],
'sortable' => $config['appearance']['useSortable'] ?? false,
'top' => [
'table' => $top['table'],
'uid' => $top['uid']
......@@ -207,7 +207,7 @@ class InlineControlContainer extends AbstractContainer
if ($type === 'select') {
// A select field is an array of uids. See TcaSelectItems data provider for details.
// Pick first entry, ends up as eg. $value = 42.
$value = $value['0'];
$value = $value['0'] ?? [];
} else {
// A group field is an array of arrays containing uid + table + title + row.
// See TcaGroup data provider for details.
......@@ -535,7 +535,7 @@ class InlineControlContainer extends AbstractContainer
}
if (($showUpload || $showByUrl) && $isDirectFileUploadEnabled) {
$folder = $backendUser->getDefaultUploadFolder(
$this->data['tableName'] === 'pages' ? $this->data['vanillaUid'] : $this->data['parentPageRow']['uid'],
$this->data['tableName'] === 'pages' ? $this->data['vanillaUid'] : ($this->data['parentPageRow']['uid'] ?? 0),
$this->data['tableName'],
$this->data['fieldName']
);
......@@ -611,6 +611,10 @@ class InlineControlContainer extends AbstractContainer
*/
protected function renderPossibleRecordsSelectorTypeSelect(array $config, array $uniqueIds)
{
$config += [
'autoSizeMax' => 0,
'foreign_table' => '',
];
$possibleRecords = $config['selectorOrUniquePossibleRecords'];
$nameObject = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']);
// Create option tags:
......
......@@ -168,7 +168,7 @@ class InlineRecordContainer extends AbstractContainer
}
$hiddenFieldHtml = implode(LF, $resultArray['additionalHiddenFields'] ?? []);
if ($inlineConfig['renderFieldsOnly']) {
if ($inlineConfig['renderFieldsOnly'] ?? false) {
// Render "body" part only
$html .= $combinationHtml;
} else {
......@@ -206,12 +206,12 @@ class InlineRecordContainer extends AbstractContainer
'data-placeholder-record' => $data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ? '1' : '0'
];
$ariaExpanded = $data['isInlineChildExpanded'] ? 'true' : 'false';
$ariaExpanded = ($data['isInlineChildExpanded'] ?? false) ? 'true' : 'false';
$ariaControls = htmlspecialchars($objectId . '_fields', ENT_QUOTES | ENT_HTML5);
$ariaAttributesString = 'aria-expanded="' . $ariaExpanded . '" aria-controls="' . $ariaControls . '"';
$html = '
<div ' . GeneralUtility::implodeAttributes($containerAttributes, true) . '>
<div class="panel-heading" data-bs-toggle="formengine-inline" id="' . htmlspecialchars($hashedObjectId, ENT_QUOTES | ENT_HTML5) . '_header" data-expandSingle="' . ($inlineConfig['appearance']['expandSingle'] ? 1 : 0) . '">
<div class="panel-heading" data-bs-toggle="formengine-inline" id="' . htmlspecialchars($hashedObjectId, ENT_QUOTES | ENT_HTML5) . '_header" data-expandSingle="' . (($inlineConfig['appearance']['expandSingle'] ?? false) ? 1 : 0) . '">
<div class="form-irre-header">
<div class="form-irre-header-cell form-irre-header-icon">
<span class="caret"></span>
......@@ -416,6 +416,11 @@ class InlineRecordContainer extends AbstractContainer
protected function renderForeignRecordHeaderControl(array $data)
{
$rec = $data['databaseRow'];
$rec += [
'uid' => 0,
'table_local' => '',
'sys_language_uid' => '',
];
$inlineConfig = $data['inlineParentConfig'];
$foreignTable = $inlineConfig['foreign_table'];
$languageService = $this->getLanguageService();
......@@ -440,8 +445,10 @@ class InlineRecordContainer extends AbstractContainer
$tcaTableCols = $GLOBALS['TCA'][$foreignTable]['columns'];
$isPagesTable = $foreignTable === 'pages';
$isSysFileReferenceTable = $foreignTable === 'sys_file_reference';
$enableManualSorting = $tcaTableCtrl['sortby'] || $inlineConfig['MM'] || !$data['isOnSymmetricSide']
&& $inlineConfig['foreign_sortby'] || $data['isOnSymmetricSide'] && $inlineConfig['symmetric_sortby'];
$enableManualSorting = ($tcaTableCtrl['sortby'] ?? false)
|| ($inlineConfig['MM'] ?? false)
|| (!($data['isOnSymmetricSide'] ?? false) && ($inlineConfig['foreign_sortby'] ?? false))
|| (($data['isOnSymmetricSide'] ?? false) && ($inlineConfig['symmetric_sortby'] ?? false));
$calcPerms = new Permission($backendUser->calcPerms(BackendUtility::readPageAccess((int)($data['parentPageRow']['uid'] ?? 0), $backendUser->getPagePermsClause(Permission::PAGE_SHOW))));
// If the listed table is 'pages' we have to request the permission settings for each page:
$localCalcPerms = new Permission(Permission::NOTHING);
......@@ -482,12 +489,12 @@ class InlineRecordContainer extends AbstractContainer
}
}
// If the table is NOT a read-only table, then show these links:
if (!$isParentReadOnly && !$tcaTableCtrl['readOnly'] && !$data['isInlineDefaultLanguageRecordInLocalizedParentContext']) {
if (!$isParentReadOnly && !($tcaTableCtrl['readOnly'] ?? false) && !($data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false)) {
// "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
if ($enabledControls['new'] && ($enableManualSorting || $tcaTableCtrl['useColumnsForDefaultValues'])) {
if (!$isPagesTable && $calcPerms->editContentPermissionIsGranted() || $isPagesTable && $calcPerms->createPagePermissionIsGranted()) {
if ((!$isPagesTable && $calcPerms->editContentPermissionIsGranted()) || ($isPagesTable && $calcPerms->createPagePermissionIsGranted())) {
$style = '';
if ($inlineConfig['inline']['inlineNewButtonStyle']) {
if ($inlineConfig['inline']['inlineNewButtonStyle'] ?? false) {
$style = ' style="' . $inlineConfig['inline']['inlineNewButtonStyle'] . '"';
}
$cells['new'] = '
......@@ -560,9 +567,9 @@ class InlineRecordContainer extends AbstractContainer
}
}
// "Delete" link:
if ($enabledControls['delete'] && ($isPagesTable && $localCalcPerms->deletePagePermissionIsGranted()
|| !$isPagesTable && $calcPerms->editContentPermissionIsGranted()
|| $isSysFileReferenceTable && $calcPerms->editPagePermissionIsGranted())
if ($enabledControls['delete'] && (($isPagesTable && $localCalcPerms->deletePagePermissionIsGranted())
|| (!$isPagesTable && $calcPerms->editContentPermissionIsGranted())
|| ($isSysFileReferenceTable && $calcPerms->editPagePermissionIsGranted()))
) {
$title = htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:delete'));
$icon = $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render();
......@@ -570,8 +577,13 @@ class InlineRecordContainer extends AbstractContainer
}
// "Hide/Unhide" links:
$hiddenField = $tcaTableCtrl['enablecolumns']['disabled'];
if ($enabledControls['hide'] && $permsEdit && $hiddenField && $tcaTableCols[$hiddenField] && (!$tcaTableCols[$hiddenField]['exclude'] || $backendUser->check('non_exclude_fields', $foreignTable . ':' . $hiddenField))) {
$hiddenField = $tcaTableCtrl['enablecolumns']['disabled'] ?? '';
if (($enabledControls['hide'] ?? false)
&& $permsEdit
&& $hiddenField
&& $tcaTableCols[$hiddenField]
&& (!($tcaTableCols[$hiddenField]['exclude'] ?? false) || $backendUser->check('non_exclude_fields', $foreignTable . ':' . $hiddenField))
) {
if ($rec[$hiddenField]) {
$title = htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')));
$cells['hide'] = '
......@@ -587,14 +599,14 @@ class InlineRecordContainer extends AbstractContainer
}
}
// Drag&Drop Sorting: Sortable handler for script.aculo.us
if ($enabledControls['dragdrop'] && $permsEdit && $enableManualSorting && $inlineConfig['appearance']['useSortable']) {
if (($enabledControls['dragdrop'] ?? false) && $permsEdit && $enableManualSorting && ($inlineConfig['appearance']['useSortable'] ?? false)) {
$cells['dragdrop'] = '
<span class="btn btn-default sortableHandle" data-id="' . htmlspecialchars($rec['uid']) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.move')) . '">
' . $this->iconFactory->getIcon('actions-move-move', Icon::SIZE_SMALL)->render() . '
</span>';
}
} elseif ($data['isInlineDefaultLanguageRecordInLocalizedParentContext'] && $isParentExisting) {
if ($enabledControls['localize'] && $data['isInlineDefaultLanguageRecordInLocalizedParentContext']) {
} elseif (($data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false) && $isParentExisting) {
if (($enabledControls['localize'] ?? false) && ($data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false)) {
$cells['localize'] = '
<button type="button" class="btn btn-default t3js-synchronizelocalize-button" data-type="' . htmlspecialchars($rec['uid']) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:localize')) . '">
' . $this->iconFactory->getIcon('actions-document-localize', Icon::SIZE_SMALL)->render() . '
......
......@@ -214,7 +214,7 @@ class PaletteAndSingleContainer extends AbstractContainer
'type' => 'linebreak',
];
} else {
if (!is_array($this->data['processedTca']['columns'][$fieldName])) {
if (!is_array($this->data['processedTca']['columns'][$fieldName] ?? null)) {
continue;
}
$options = $this->data;
......
......@@ -180,6 +180,13 @@ class SingleFieldContainer extends AbstractContainer
$fieldName = $this->data['fieldName'];
$fieldConfig = $this->data['processedTca']['columns'][$fieldName]['config'];
$fieldConfig += [
'MM' => '',
'foreign_table' => '',
'foreign_selector' => '',
'foreign_field' => '',
];
/** @var InlineStackProcessor $inlineStackProcessor */
$inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class);
$inlineStackProcessor->initializeByGivenStructure($this->data['inlineStructure']);
......@@ -198,7 +205,7 @@ class SingleFieldContainer extends AbstractContainer
'appearance' => ['useCombination' => true],
'foreign_selector' => $fieldName
],
'MM' => $fieldConfig['MM']
'MM' => $fieldConfig['MM'],
]
]
],
......
......@@ -172,6 +172,10 @@ class SelectCheckBoxElement extends AbstractFormElement
// Building the checkboxes
foreach ($groups as $groupKey => $group) {
$group += [
'items' => [],
'header' => false,
];
$groupId = htmlspecialchars($parameterArray['itemFormElID']) . '-group-' . $groupKey;
$groupIdCollapsible = $groupId . '-collapse';
$html[] = '<div id="' . $groupId . '" class="panel panel-default">';
......
......@@ -87,7 +87,7 @@ class SelectSingleElement extends AbstractFormElement
$inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class);
$inlineStackProcessor->initializeByGivenStructure($this->data['inlineStructure']);
$uniqueIds = null;
if ($this->data['isInlineChild'] && $this->data['inlineParentUid']) {
if (($this->data['isInlineChild'] ?? false) && ($this->data['inlineParentUid'] ?? false)) {
// @todo: At least parts of this if is dead and/or broken: $uniqueIds is filled but never used.
// See InlineControlContainer where 'inlineData' 'unique' 'used' is set. What exactly is
// this if supposed to do and when should it kick in and what for?
......@@ -101,8 +101,8 @@ class SelectSingleElement extends AbstractFormElement
// hide uid of parent record for symmetric relations
if ($this->data['inlineParentConfig']['foreign_table'] === $table
&& (
$this->data['inlineParentConfig']['foreign_field'] === $field
|| $this->data['inlineParentConfig']['symmetric_field'] === $field
($this->data['inlineParentConfig']['foreign_field'] ?? false) === $field
|| ($this->data['inlineParentConfig']['symmetric_field'] ?? false) === $field
)
) {
$uniqueIds[] = $this->data['inlineParentUid'];
......
......@@ -49,7 +49,7 @@ class SelectIcons extends AbstractNode
$fieldValue = $this->data['databaseRow'][$this->data['fieldName']];
$selectIcons[] = [
'title' => $item[0],
'active' => ($fieldValue[0] === (string)$item[1]) ? true : false,
'active' => ($fieldValue[0] ?? false) === (string)($item[1] ?? ''),
'icon' => $icon,
'index' => $selectItemCounter,
];
......
......@@ -1036,7 +1036,7 @@ abstract class AbstractItemProvider
$table = $result['tableName'];
$row = $result['databaseRow'];
$uid = $row['uid'];
if (BackendUtility::isTableWorkspaceEnabled($table) && (int)$row['t3ver_oid'] > 0) {
if (BackendUtility::isTableWorkspaceEnabled($table) && (int)($row['t3ver_oid'] ?? 0) > 0) {
$uid = $row['t3ver_oid'];
}
return $uid;
......
......@@ -305,9 +305,9 @@ class SiteTcaInline extends AbstractDatabaseRecordProvider implements FormDataPr
'inlineParentUid' => $result['databaseRow']['uid'],
'inlineParentTableName' => $result['tableName'],
'inlineParentFieldName' => $parentFieldName,
'inlineTopMostParentUid' => ($result['inlineTopMostParentUid'] ?? false) ?: $inlineTopMostParent['uid'],
'inlineTopMostParentTableName' => ($result['inlineTopMostParentTableName'] ?? false) ?: $inlineTopMostParent['table'],
'inlineTopMostParentFieldName' => ($result['inlineTopMostParentFieldName'] ?? false) ?: $inlineTopMostParent['field'],
'inlineTopMostParentUid' => ($result['inlineTopMostParentUid'] ?? false) ?: ($inlineTopMostParent['uid'] ?? 0),
'inlineTopMostParentTableName' => ($result['inlineTopMostParentTableName'] ?? false) ?: ($inlineTopMostParent['table'] ?? ''),
'inlineTopMostParentFieldName' => ($result['inlineTopMostParentFieldName'] ?? false) ?: ($inlineTopMostParent['field'] ?? ''),
// The sys_language uid 0
'inlineChildChildUid' => 0,
];
......
......@@ -262,7 +262,7 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
*/
protected function addForeignSelectorAndUniquePossibleRecords(array $result, $fieldName)
{
if (!is_array($result['processedTca']['columns'][$fieldName]['config']['selectorOrUniqueConfiguration'])) {
if (!is_array($result['processedTca']['columns'][$fieldName]['config']['selectorOrUniqueConfiguration'] ?? null)) {
return $result;
}
......@@ -320,7 +320,7 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
/** @var InlineStackProcessor $inlineStackProcessor */
$inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class);
$inlineStackProcessor->initializeByGivenStructure($result['inlineStructure']);
$inlineTopMostParent = $inlineStackProcessor->getStructureLevel(0);
$inlineTopMostParent = $inlineStackProcessor->getStructureLevel(0) ?: [];
/** @var TcaDatabaseRecord $formDataGroup */
$formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class);
......@@ -347,16 +347,16 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
'inlineParentFieldName' => $parentFieldName,
// values of the top most parent element set on first level and not overridden on following levels
'inlineTopMostParentUid' => $result['inlineTopMostParentUid'] ?: $inlineTopMostParent['uid'],
'inlineTopMostParentTableName' => $result['inlineTopMostParentTableName'] ?: $inlineTopMostParent['table'],
'inlineTopMostParentFieldName' => $result['inlineTopMostParentFieldName'] ?: $inlineTopMostParent['field'],
'inlineTopMostParentUid' => $result['inlineTopMostParentUid'] ?: $inlineTopMostParent['uid'] ?? '',
'inlineTopMostParentTableName' => $result['inlineTopMostParentTableName'] ?: $inlineTopMostParent['table'] ?? '',
'inlineTopMostParentFieldName' => $result['inlineTopMostParentFieldName'] ?: $inlineTopMostParent['field'] ?? '',
];
// For foreign_selector with useCombination $mainChild is the mm record
// and $combinationChild is the child-child. For 1:n "normal" relations,
// $mainChild is just the normal child record and $combinationChild is empty.
$mainChild = $formDataCompiler->compile($formDataCompilerInput);
if ($parentConfig['foreign_selector'] && $parentConfig['appearance']['useCombination']) {
if (($parentConfig['foreign_selector'] ?? false) && ($parentConfig['appearance']['useCombination'] ?? false)) {
try {
$mainChild['combinationChild'] = $this->compileChildChild($mainChild, $parentConfig);
} catch (DatabaseRecordException $e) {
......
......@@ -39,7 +39,7 @@ class TcaInlineIsOnSymmetricSide implements FormDataProviderInterface
}
$result['isOnSymmetricSide'] = MathUtility::canBeInterpretedAsInteger($result['databaseRow']['uid'])
&& $result['inlineParentConfig']['symmetric_field']
&& ($result['inlineParentConfig']['symmetric_field'] ?? false)
// non-strict comparison by intention
&& $result['inlineParentUid'] == $result['databaseRow'][$result['inlineParentConfig']['symmetric_field']][0];
......
......@@ -139,7 +139,7 @@ class TcaInputPlaceholders implements FormDataProviderInterface
if (!empty($GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField'])
&& isset($result['databaseRow'][$GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField']])
) {
$relatedFormData['currentSysLanguage'] = $result['databaseRow'][$GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField']][0];
$relatedFormData['currentSysLanguage'] = $result['databaseRow'][$GLOBALS['TCA'][$result['tableName']]['ctrl']['languageField'] ?? null][0] ?? '';
}
$value = $this->getPlaceholderValue($fieldNameArray, $relatedFormData, $recursionLevel + 1);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment