Skip to content

Commit

Permalink
Support config of dataContainer driver as classes
Browse files Browse the repository at this point in the history
  • Loading branch information
rabauss committed Mar 17, 2023
1 parent 33ef0a3 commit 4a8f7b9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,10 @@ public function treeView()
// Child mode
if ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 6) {
$table = $GLOBALS['TL_DCA'][$this->strTable]['config']['ptable'];
$drivers = ['Multilingual', __CLASS__, \DC_Multilingual::class];

if ($GLOBALS['TL_DCA'][$table]['config']['dataContainer'] == 'Multilingual') {
if (isset($GLOBALS['TL_DCA'][$table]['config']['dataContainer'])
&& \in_array($GLOBALS['TL_DCA'][$table]['config']['dataContainer'], $drivers, true)) {
$where[] = "$this->langColumnName=''";
}

Expand Down Expand Up @@ -866,8 +868,10 @@ protected function generateTree($table, $id, $arrPrevNext, $blnHasSorting, $intM
// Check whether there are child records
if (!$blnNoRecursion) {
Controller::loadDataContainer($table);
$drivers = ['Multilingual', __CLASS__, \DC_Multilingual::class];

if ($GLOBALS['TL_DCA'][$table]['config']['dataContainer'] === 'Multilingual'
if (isset($GLOBALS['TL_DCA'][$table]['config']['dataContainer'])
&& \in_array($GLOBALS['TL_DCA'][$table]['config']['dataContainer'], $drivers, true)
&& ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] === 5 || $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] === 6 || $this->strTable != $table)
) {
$langColumn = $GLOBALS['TL_DCA'][$table]['config']['langColumnName'] ?? 'language';
Expand Down Expand Up @@ -1127,7 +1131,10 @@ public function deleteChilds($table, $id, &$delete)
parent::deleteChilds($table, $id, $delete);

// Do not delete record if it is not a multilingual dataContainer
if ('Multilingual' !== $GLOBALS['TL_DCA'][$table]['config']['dataContainer']) {
$drivers = ['Multilingual', __CLASS__, \DC_Multilingual::class];

if (isset($GLOBALS['TL_DCA'][$table]['config']['dataContainer'])
&& \in_array($GLOBALS['TL_DCA'][$table]['config']['dataContainer'], $drivers, true)) {
return;
}

Expand Down

0 comments on commit 4a8f7b9

Please sign in to comment.