Skip to content

Commit

Permalink
Replace array_merge with array_replace
Browse files Browse the repository at this point in the history
  • Loading branch information
Tastaturberuf committed Jan 10, 2024
1 parent e977fca commit 04c09a8
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 33 deletions.
7 changes: 2 additions & 5 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,8 @@
*
* You can register your mappings in the config.php file of your extension.
*/
array_insert($GLOBALS['TL_MODELS'], 0, array
(
'tl_anystores_category' => 'Tastaturberuf\AnyStoresCategoryModel',
'tl_anystores' => 'Tastaturberuf\AnyStoresModel'
));
$GLOBALS['TL_MODELS']['tl_anystores_category'] = Tastaturberuf\AnyStoresCategoryModel::class;
$GLOBALS['TL_MODELS']['tl_anystores'] = Tastaturberuf\AnyStoresModel::class;


/**
Expand Down
8 changes: 5 additions & 3 deletions dca/tl_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* Fields
*/
array_insert($GLOBALS['TL_DCA']['tl_form']['fields'], 0, array
$GLOBALS['TL_DCA']['tl_form']['fields'] = array_replace_recursive($GLOBALS['TL_DCA']['tl_form']['fields'] ?? [], array
(
'anystores_sendEmail' => array
(
Expand Down Expand Up @@ -76,6 +76,8 @@ class tl_form_anystores

public function getFormFields(DataContainer $dc)
{
$arrFields = [];

$arrOptions = array
(
'column' => array("type='stores'")
Expand All @@ -89,9 +91,9 @@ public function getFormFields(DataContainer $dc)
{
$arrFields[$objFields->name] = $objFields->label;
}

return $arrFields;
}

return $arrFields;
}

}
10 changes: 5 additions & 5 deletions dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Add palettes to tl_module
*/
array_insert($GLOBALS['TL_DCA']['tl_module']['palettes'], 1337, array
$GLOBALS['TL_DCA']['tl_module']['palettes'] = array_replace_recursive($GLOBALS['TL_DCA']['tl_module']['palettes'] ?? [], array
(
'anystores_search' => '
{title_legend},name,headline,type;
Expand Down Expand Up @@ -70,7 +70,7 @@
/**
* Add fields to tl_module
*/
array_insert($GLOBALS['TL_DCA']['tl_module']['fields'], 0, array
$GLOBALS['TL_DCA']['tl_module']['fields'] = array_replace_recursive($GLOBALS['TL_DCA']['tl_module']['fields'] ?? [], array
(
'anystores_defaultCountry' => array
(
Expand Down Expand Up @@ -118,9 +118,9 @@
'anystores_allowEmptySearch' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['anystores_allowEmptySearch'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => true,
'exclude' => true,
'inputType' => 'checkbox',
'default' => true,
'eval' => array
(
'submitOnChange' => true,
Expand Down
7 changes: 5 additions & 2 deletions dca/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/**
* Palettes
*/

use Tastaturberuf\AnyStoresCategoryModel;

$GLOBALS['TL_DCA']['tl_page']['palettes']['root'] .= ';{anystores_legend},anystores_sitemap';


Expand All @@ -31,7 +34,7 @@
/**
* Fields
*/
array_insert($GLOBALS['TL_DCA']['tl_page']['fields'], 0, array
$GLOBALS['TL_DCA']['tl_page']['fields'] = array_replace_recursive($GLOBALS['TL_DCA']['tl_page']['fields'] ?? [], array
(
'anystores_sitemap' => array
(
Expand Down Expand Up @@ -69,7 +72,7 @@

if ( $objCategories === null )
{
return;
return [];
}

return $objCategories->fetchEach('title');
Expand Down
2 changes: 1 addition & 1 deletion dca/tl_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Fields
*/
array_insert($GLOBALS['TL_DCA']['tl_user']['fields'], 0, array
$GLOBALS['TL_DCA']['tl_user']['fields'] = array_replace_recursive($GLOBALS['TL_DCA']['tl_user']['fields'] ?? [], array
(
'anystores_categories' => array
(
Expand Down
2 changes: 1 addition & 1 deletion dca/tl_user_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* Fields
*/
array_insert($GLOBALS['TL_DCA']['tl_user_group']['fields'], 0, array
$GLOBALS['TL_DCA']['tl_user_group']['fields'] = array_replace_recursive($GLOBALS['TL_DCA']['tl_user_group']['fields'] ?? [], array
(
'anystores_categories' => array
(
Expand Down
4 changes: 2 additions & 2 deletions languages/de/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* Front end modules
*/
array_insert($GLOBALS['TL_LANG']['FMD'], 0, array
$GLOBALS['TL_LANG']['FMD'] = array_replace($GLOBALS['TL_LANG']['FMD'] ?? [], array
(
'anystores' => 'AnyStores',
'anystores_search' => array('anyStores Suche', 'Suchformular für Standorte.'),
Expand All @@ -33,7 +33,7 @@
));


array_insert($GLOBALS['TL_LANG']['tl_module'], 0, array
$GLOBALS['TL_LANG']['tl_module'] = array_replace($GLOBALS['TL_LANG']['tl_module'] ?? [], array
(
'map_legend' => 'Karteneinstellungen',
'map_api_legend' => 'API-Einstellungen',
Expand Down
2 changes: 1 addition & 1 deletion languages/de/tl_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_form'], 0, array
$GLOBALS['TL_LANG']['tl_form'] = array_replace($GLOBALS['TL_LANG']['tl_form'] ?? [], array
(
'anystores_legend' => 'AnyStores-Einstellungen',
'anystores_sendEmail' => array
Expand Down
4 changes: 2 additions & 2 deletions languages/de/tl_form_field.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
*/


array_insert($GLOBALS['TL_LANG']['FFL'], 0, array
$GLOBALS['TL_LANG']['FFL'] = array_replace($GLOBALS['TL_LANG']['FFL'] ?? [], array
(
'stores' => array('anyStores Liste', '')
));

array_insert($GLOBALS['TL_LANG']['tl_form_field'], 0, array
$GLOBALS['TL_LANG']['tl_form_field'] = array_replace($GLOBALS['TL_LANG']['tl_form_field'] ?? [], array
(
'anystores_idField' => array('Spalte für den Value-Wert', ''),
'anystores_categories' => array('Kategorien', '')
Expand Down
2 changes: 1 addition & 1 deletion languages/de/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_page'], 0, array
$GLOBALS['TL_LANG']['tl_page'] = array_replace($GLOBALS['TL_LANG']['tl_page'] ?? [], array
(
'anystores_legend' => 'anyStores-Einstellungen',
'anystores_sitemap' => array('Zur Sitemap hinzufügen', 'Aktivieren um definierte Standorte in der Sitemap anzuzeigen.'),
Expand Down
2 changes: 1 addition & 1 deletion languages/de/tl_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_user'], 0, array
$GLOBALS['TL_LANG']['tl_user'] = array_replace($GLOBALS['TL_LANG']['tl_user'] ?? [], array
(

'anystores_legend' => 'anyStores-Rechte',
Expand Down
2 changes: 1 addition & 1 deletion languages/de/tl_user_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_user_group'], 0, array
$GLOBALS['TL_LANG']['tl_user_group'] = array_replace($GLOBALS['TL_LANG']['tl_user_group'] ?? [], array
(

'anystores_legend' => 'anyStores-Rechte',
Expand Down
4 changes: 2 additions & 2 deletions languages/en/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* Front end modules
*/
array_insert($GLOBALS['TL_LANG']['FMD'], 0, array
$GLOBALS['TL_LANG']['FMD'] = array_replace($GLOBALS['TL_LANG']['FMD'] ?? [], array
(
'anystores' => 'AnyStores',
'anystores_search' => array('anyStores Search', 'Searchform for locations.'),
Expand All @@ -33,7 +33,7 @@
));


array_insert($GLOBALS['TL_LANG']['tl_module'], 0, array
$GLOBALS['TL_LANG']['tl_module'] = array_replace($GLOBALS['TL_LANG']['tl_module'] ?? [], array
(
'map_legend' => 'Map settings',
'map_api_legend' => 'API settings',
Expand Down
2 changes: 1 addition & 1 deletion languages/en/tl_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_form'], 0, array
$GLOBALS['TL_LANG']['tl_form'] = array_replace($GLOBALS['TL_LANG']['tl_form'] ?? [], array
(
'anystores_legend' => 'AnyStores settings',
'anystores_sendEmail' => array
Expand Down
4 changes: 2 additions & 2 deletions languages/en/tl_form_field.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
*/


array_insert($GLOBALS['TL_LANG']['FFL'], 0, array
$GLOBALS['TL_LANG']['FFL'] = array_replace($GLOBALS['TL_LANG']['FFL'] ?? [], array
(
'stores' => array('anyStores list', '')
));

array_insert($GLOBALS['TL_LANG']['tl_form_field'], 0, array
$GLOBALS['TL_LANG']['tl_form_field'] = array_replace($GLOBALS['TL_LANG']['tl_form_field'] ?? [], array
(
'anystores_idField' => array('Column for the value', ''),
'anystores_categories' => array('Categories', '')
Expand Down
2 changes: 1 addition & 1 deletion languages/en/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_page'], 0, array
$GLOBALS['TL_LANG']['tl_page'] = array_replace($GLOBALS['TL_LANG']['tl_page'] ?? [], array
(
'anystores_legend' => 'anyStores settings',
'anystores_sitemap' => array('Add to sitemap', 'Check to integrate locations to the sitemap.'),
Expand Down
2 changes: 1 addition & 1 deletion languages/en/tl_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_user'], 0, array
$GLOBALS['TL_LANG']['tl_user'] = array_replace($GLOBALS['TL_LANG']['tl_user'] ?? [], array
(

'anystores_legend' => 'anyStores permissions',
Expand Down
2 changes: 1 addition & 1 deletion languages/en/tl_user_goup.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/


array_insert($GLOBALS['TL_LANG']['tl_user_group'], 0, array
$GLOBALS['TL_LANG']['tl_user_group'] = array_replace($GLOBALS['TL_LANG']['tl_user_group'] ?? [], array
(

'anystores_legend' => 'anyStores permissions',
Expand Down

0 comments on commit 04c09a8

Please sign in to comment.