Skip to content

Commit

Permalink
see cl 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Patzer committed Feb 15, 2022
1 parent 2fcecba commit c1781ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [1.3.2] - 2022-02-15

- Fixed: array index issues in php 8+

## [1.3.1] - 2022-02-15

- Fixed: array index issues in php 8+
Expand Down
43 changes: 21 additions & 22 deletions src/Backend/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,12 @@ public static function getCategoryFieldDca($evalOverride = null, $label = null)
\System::loadLanguageFile('tl_category');

$eval = [
'label' => &$GLOBALS['TL_LANG']['tl_category']['category'],
'tl_class' => 'w50 autoheight',
'mandatory' => true,
'fieldType' => 'radio',
'isCategoryField' => true,
];

if ($label) {
unset($eval['label']);
$eval['label'] = $label;
}

if (\is_array($evalOverride)) {
$eval = array_merge($eval, $evalOverride);
}
Expand All @@ -159,8 +153,8 @@ public static function getCategoryFieldDca($evalOverride = null, $label = null)

$dca['config']['ondelete_callback']['deleteEntityCategoryAssociations'] = [static::class, 'deleteEntityCategoryAssociations'];

return [
'label' => &$label,
$data = [
'label' => &$GLOBALS['TL_LANG']['tl_category']['category'],
'exclude' => true,
'filter' => true,
'inputType' => 'categoryTree',
Expand All @@ -170,6 +164,13 @@ public static function getCategoryFieldDca($evalOverride = null, $label = null)
'eval' => $eval,
'sql' => "int(10) unsigned NOT NULL default '0'",
];

if ($label) {
unset($data['label']);
$data['label'] = $label;
}

return $data;
}

/**
Expand All @@ -185,19 +186,13 @@ public static function addSingleCategoryFieldToDca($table, $name, $evalOverride
\System::loadLanguageFile('tl_category');

$eval = [
'label' => &$GLOBALS['TL_LANG']['tl_category']['category'],
'tl_class' => 'w50 autoheight clr',
'mandatory' => true,
'fieldType' => 'radio',
'doNotCopy' => true,
'isCategoryField' => true,
];

if ($label) {
unset($eval['label']);
$eval['label'] = $label;
}

if (\is_array($evalOverride)) {
$eval = array_merge($eval, $evalOverride);
}
Expand All @@ -207,7 +202,7 @@ public static function addSingleCategoryFieldToDca($table, $name, $evalOverride
$dca = &$GLOBALS['TL_DCA'][$table];

$dca['fields'][$name] = [
'label' => &$label,
'label' => &$GLOBALS['TL_LANG']['tl_category']['category'],
'exclude' => true,
'filter' => true,
'inputType' => 'categoryTree',
Expand All @@ -218,6 +213,11 @@ public static function addSingleCategoryFieldToDca($table, $name, $evalOverride
'sql' => "int(10) unsigned NOT NULL default '0'",
];

if ($label) {
unset($dca['fields'][$name]['label']);
$dca['fields'][$name]['label'] = $label;
}

// add the deletion callback on record level
$dca['config']['ondelete_callback'] = isset($dca['config']['ondelete_callback']) && \is_array($dca['config']['ondelete_callback']) ? $dca['config']['ondelete_callback'] : [];

Expand All @@ -237,7 +237,6 @@ public static function addMultipleCategoriesFieldToDca($table, $name, $evalOverr
\System::loadLanguageFile('tl_category');

$eval = [
'label' => &$GLOBALS['TL_LANG']['tl_category']['categories'],
'tl_class' => 'w50 autoheight clr',
'mandatory' => true,
'doNotCopy' => true,
Expand All @@ -248,11 +247,6 @@ public static function addMultipleCategoriesFieldToDca($table, $name, $evalOverr
'isCategoryField' => true,
];

if ($label) {
unset($eval['label']);
$eval['label'] = $label;
}

if (\is_array($evalOverride)) {
$eval = array_merge($eval, $evalOverride);
}
Expand All @@ -262,7 +256,7 @@ public static function addMultipleCategoriesFieldToDca($table, $name, $evalOverr
$dca = &$GLOBALS['TL_DCA'][$table];

$dca['fields'][$name] = [
'label' => &$label,
'label' => &$GLOBALS['TL_LANG']['tl_category']['categories'],
'exclude' => true,
'filter' => true,
'inputType' => 'categoryTree',
Expand All @@ -276,6 +270,11 @@ public static function addMultipleCategoriesFieldToDca($table, $name, $evalOverr
'sql' => 'blob NULL',
];

if ($label) {
unset($dca['fields'][$name]['label']);
$dca['fields'][$name]['label'] = $label;
}

if ($eval['addPrimaryCategory']) {
$dca['fields'][$name.static::PRIMARY_CATEGORY_SUFFIX] = [
'sql' => "int(10) unsigned NOT NULL default '0'",
Expand Down

0 comments on commit c1781ba

Please sign in to comment.