Options
Unix command (sed) for convert Dictionary to SetDefinition
Developers of extension, this message is for you.
Hello community (it's my first message
),
I made a command (for Unix-Like users) for convert your extension(s) from the old system (Dictionary) to the new (SetDefinition).
Original file 'default.php' (mix " with ' and multiple spaces or no space near the '=' for example)
(default.php has not been modified !)
quote="\(\"\|'\)" && space="[[:blank:]]*" && sed -e s/"\$Context->Dictionary\[$quote\(.*\)$quote\]${space}=.*${quote}\(.*\)${quote}"/"\$Context->SetDefinition('\\2', '\\5')"/g default.php > default_with_SetDefinition.php
Result : good and unique presentation and SetDefinition used.
Sorry for my bad english, I'm French.
Hello community (it's my first message

I made a command (for Unix-Like users) for convert your extension(s) from the old system (Dictionary) to the new (SetDefinition).
Original file 'default.php' (mix " with ' and multiple spaces or no space near the '=' for example)
$Context->Dictionary["Test_1"] = "Blabla 1";File 'default_with_SetDefinition.php' generated after to have started the command
$Context->Dictionary['Test_2'] = 'Blabla 2';
$Context->Dictionary["Test_3"] = 'Blabla 3';
$Context->Dictionary['Test_4'] = "Blabla 4";
$Context->Dictionary["Test_5"]="Blabla 5";
$Context->Dictionary["Test_6"]*multiple_spaces_here*=*multiple_spaces_here*"Blabla 6";
$Context->Dictionary['Test_7'] = $Variable = 'Blabla 7';
(default.php has not been modified !)
$Context->SetDefinition('Test_1', 'Blabla 1');--> The command
$Context->SetDefinition('Test_2', 'Blabla 2');
$Context->SetDefinition('Test_3', 'Blabla 3');
$Context->SetDefinition('Test_4', 'Blabla 4');
$Context->SetDefinition('Test_5', 'Blabla 5');
$Context->SetDefinition('Test_6', 'Blabla 6');
$Context->SetDefinition('Test_7', 'Blabla 7');
quote="\(\"\|'\)" && space="[[:blank:]]*" && sed -e s/"\$Context->Dictionary\[$quote\(.*\)$quote\]${space}=.*${quote}\(.*\)${quote}"/"\$Context->SetDefinition('\\2', '\\5')"/g default.php > default_with_SetDefinition.php
Result : good and unique presentation and SetDefinition used.

Sorry for my bad english, I'm French.
0
This discussion has been closed.
Comments
$Context->Dictionary['DiscussionFilters'] = $DiscussionFilters = 'Discussion Filters';
Missing define "space" variable in the "new version".
N.B. : New post for up (because missing element).