Skip to content

Commit 0f39dfb

Browse files
authored
[Task] Standardize naming conventions in the configuration (#1713)
* unify naming of studio config * Apply php-cs-fixer changes
1 parent 846cb26 commit 0f39dfb

15 files changed

Lines changed: 483 additions & 78 deletions

File tree

config/pimcore/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pimcore_studio_backend:
9090
types:
9191
asset: ['content', 'seo', 'warning', 'notice']
9292
document: ['content', 'seo', 'warning', 'notice']
93-
data-object: ['content', 'seo', 'warning', 'notice']
93+
data_object: ['content', 'seo', 'warning', 'notice']
9494

9595
widget_types:
9696
- 'element_tree'

config/pimcore/default_perspective.yaml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,55 @@ studio_default_perspective:
44
icon:
55
type: "name"
66
value: "pimcore"
7-
widgetsLeft:
7+
widgets_left:
88
studio_document_tree_widget:
99
id: "studio_document_tree_widget"
1010
name: "document.document-tree.title"
1111
widget_type: "element_tree"
12-
elementType: "document"
12+
element_type: "document"
1313
icon:
1414
type: "name"
1515
value: "document"
16-
rootFolder: "/"
17-
showRoot: true
16+
root_folder: "/"
17+
show_root: true
1818
pql: null
19-
pageSize: null # use default page size
19+
page_size: null # use default page size
2020
classes: []
21-
contextPermissions: [] # use all default context permissions
22-
isWriteable: false
21+
context_permissions: [] # use all default context permissions
22+
is_writeable: false
2323
studio_asset_tree_widget:
2424
id: "studio_asset_tree_widget"
2525
name: "asset.asset-tree.title"
2626
widget_type: "element_tree"
27-
elementType: "asset"
27+
element_type: "asset"
2828
icon:
2929
type: "name"
3030
value: "asset"
31-
rootFolder: "/"
32-
showRoot: true
31+
root_folder: "/"
32+
show_root: true
3333
pql: null
34-
pageSize: null # use default page size
34+
page_size: null # use default page size
3535
classes: []
36-
contextPermissions: [] # use all default context permissions
37-
isWriteable: false
36+
context_permissions: [] # use all default context permissions
37+
is_writeable: false
3838
studio_data_object_tree_widget:
3939
id: "studio_data_object_tree_widget"
4040
name: "data-object.data-object-tree.title"
4141
widget_type: "element_tree"
42-
elementType: "data-object"
42+
element_type: "data-object"
4343
icon:
4444
type: "name"
4545
value: "data-object"
46-
rootFolder: "/"
47-
showRoot: true
46+
root_folder: "/"
47+
show_root: true
4848
pql: null
49-
pageSize: null # use default page size
49+
page_size: null # use default page size
5050
classes: []
51-
contextPermissions: [] # use all default context permissions
52-
isWriteable: false
53-
widgetsRight: []
54-
widgetsBottom: []
55-
expandedLeft: "studio_document_tree_widget"
56-
expandedRight: null
57-
contextPermissions: []
58-
isWriteable: false
51+
context_permissions: [] # use all default context permissions
52+
is_writeable: false
53+
widgets_right: []
54+
widgets_bottom: []
55+
expanded_left: "studio_document_tree_widget"
56+
expanded_right: null
57+
context_permissions: []
58+
is_writeable: false

config/services.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ services:
1515
Pimcore\Bundle\StudioBackendBundle\Cache\Service\CacheClearerServiceInterface:
1616
class: Pimcore\Bundle\StudioBackendBundle\Cache\Service\CacheClearerService
1717

18+
Pimcore\Bundle\StudioBackendBundle\Util\Config\ConfigKeyMapperInterface:
19+
class: Pimcore\Bundle\StudioBackendBundle\Util\Config\ConfigKeyMapper
20+
1821

1922

2023

doc/10_Extending_Studio/05_Perspectives/01_Widgets.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,16 @@ pimcore_studio_backend:
327327
1efe7ac9_a03a_6334_9e48_13f662882599:
328328
id: 1efe7ac9_a03a_6334_9e48_13f662882599
329329
name: 'My Object Tree Widget'
330-
elementType: 'data-object' # data-object, asset or document types are supported
330+
element_type: 'data-object' # data-object, asset or document types are supported
331331
icon:
332332
type: path
333333
value: 'path/to/config-icon.svg'
334-
rootFolder: '/path/to/root/folder'
335-
showRoot: true
334+
root_folder: '/path/to/root/folder'
335+
show_root: true
336336
classes: ['CAR']
337337
pql: null # PQL query to filter the tree items
338-
pageSize: 50 # define custom page size for your tree
339-
contextPermissions:
338+
page_size: 50 # define custom page size for your tree
339+
context_permissions:
340340
add: true
341341
addFolder: true
342342
changeChildrenSortBy: true

doc/10_Extending_Studio/09_Perspectives.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ pimcore_studio_backend:
9393
icon: # Use null to use the default icon
9494
type: "path"
9595
value: "/path/to/custom/icon.svg"
96-
widgetsLeft:
96+
widgets_left:
9797
1efe7ac9_a03a_6334_9e48_13f662882599: "my_widget_type" # Array of widget ID => widget type
9898
d061699e_da42_4075_b504_c2c93c687819: "my_widget_type" # Array of widget ID => widget type
99-
widgetsRight: []
100-
widgetsBottom: []
101-
expandedLeft: "d061699e_da42_4075_b504_c2c93c687819" # ID of widget which should be expanded
102-
expandedRight: null
103-
contextPermissions: [] # When empty all registered permissions will be used with default values
99+
widgets_right: []
100+
widgets_bottom: []
101+
expanded_left: "d061699e_da42_4075_b504_c2c93c687819" # ID of widget which should be expanded
102+
expanded_right: null
103+
context_permissions: [] # When empty all registered permissions will be used with default values
104104
```
105105
106106
:::info

doc/10_Extending_Studio/11_Gdpr.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ The GDPR Data Extractor can be configured. The following options are available:
4545
```yaml
4646
pimcore_studio_backend:
4747
gdpr_data_extractor:
48-
dataObjects:
48+
data_objects:
4949
classes:
5050
# Configure which classes should be considered
5151
# Array key is the class name
5252
Person:
53-
allowDelete: true # Allow delete of objects directly in preview grid (default: false)
53+
allow_delete: true # Allow delete of objects directly in preview grid (default: false)
5454
Customer:
55-
allowDelete: false
55+
allow_delete: false
5656
assets:
5757
types:
5858
# Configure which asset types should be considered
@@ -63,11 +63,11 @@ pimcore_studio_backend:
6363
6464
### Configuration Options
6565
66-
| Option | Type | Default | Description |
67-
|-------------------------------------------------------------------|---------|---------|------------------------------------------------------------------------------------------------------------|
68-
| `gdpr_data_extractor.dataObjects.classes` | array | `[]` | Configure which Data Object classes should be considered for GDPR search. The array key is the class name. |
69-
| `gdpr_data_extractor.dataObjects.classes.<ClassName>.allowDelete` | boolean | `false` | Allow deletion of objects directly in the preview grid. |
70-
| `gdpr_data_extractor.assets.types` | array | `[]` | Configure which asset types should be considered for GDPR search (e.g., `image`, `document`, `video`). |
66+
| Option | Type | Default | Description |
67+
|---------------------------------------------------------------------|---------|---------|------------------------------------------------------------------------------------------------------------|
68+
| `gdpr_data_extractor.data_objects.classes` | array | `[]` | Configure which Data Object classes should be considered for GDPR search. The array key is the class name. |
69+
| `gdpr_data_extractor.data_objects.classes.<ClassName>.allow_delete` | boolean | `false` | Allow deletion of objects directly in the preview grid. |
70+
| `gdpr_data_extractor.assets.types` | array | `[]` | Configure which asset types should be considered for GDPR search (e.g., `image`, `document`, `video`). |
7171

7272
## Example Data Provider
7373

src/DependencyInjection/CompilerPass/DataProviderPass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Pimcore\Bundle\StudioBackendBundle\Exception\MustImplementInterfaceException;
1717
use Pimcore\Bundle\StudioBackendBundle\Gdpr\Provider\DataProviderInterface;
1818
use Pimcore\Bundle\StudioBackendBundle\Gdpr\Service\Loader\TaggedIteratorDataProviderLoader;
19+
use Pimcore\Bundle\StudioBackendBundle\Util\Config\ConfigKeyMapper;
1920
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\MustImplementInterfaceTrait;
2021
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2122
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -42,6 +43,7 @@ public function process(ContainerBuilder $container): void
4243
);
4344

4445
$gdprConfig = $container->getParameter(self::GDPR_CONFIG_PARAMETER);
46+
$gdprConfig = ConfigKeyMapper::convertKeysForApp($gdprConfig);
4547

4648
foreach ($taggedServices as $dataProviderId) {
4749
$this->checkInterface($dataProviderId, DataProviderInterface::class);

src/DependencyInjection/Configuration.php

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Pimcore\Bundle\StudioBackendBundle\Exception\InvalidHostException;
1818
use Pimcore\Bundle\StudioBackendBundle\Perspective\Util\Constant\WidgetTypes;
1919
use Pimcore\Bundle\StudioBackendBundle\Setting\Admin\Repository\SettingRepository;
20+
use Pimcore\Bundle\StudioBackendBundle\Util\Config\ConfigKeyMapper;
2021
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\Asset\DownloadLimits;
2122
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\Asset\MimeTypes;
2223
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\Asset\ResizeModes;
@@ -361,6 +362,11 @@ private function addNoteTypes(ArrayNodeDefinition $node): void
361362
->addDefaultsIfNotSet()
362363
->children()
363364
->arrayNode('types')
365+
->beforeNormalization()
366+
->always(fn (mixed $v) => is_array($v)
367+
? ConfigKeyMapper::convertKeysForApp($v)
368+
: $v)
369+
->end()
364370
->info('List all note types for asset, document, and data-object.')
365371
->normalizeKeys(false)
366372
->children()
@@ -451,6 +457,11 @@ private function addPerspectivesConfigurationNode(ArrayNodeDefinition $node): vo
451457
->defaultValue([])
452458
->useAttributeAsKey('id')
453459
->arrayPrototype()
460+
->beforeNormalization()
461+
->always(fn (mixed $v) => is_array($v)
462+
? ConfigKeyMapper::convertKeysForConfig($v)
463+
: $v)
464+
->end()
454465
->children()
455466
->scalarNode('name')
456467
->isRequired()
@@ -475,7 +486,7 @@ private function addPerspectivesConfigurationNode(ArrayNodeDefinition $node): vo
475486
->end()
476487
->end()
477488
->end()
478-
->arrayNode('widgetsLeft')
489+
->arrayNode('widgets_left')
479490
->useAttributeAsKey('id')
480491
->scalarPrototype()
481492
->validate()
@@ -484,7 +495,7 @@ private function addPerspectivesConfigurationNode(ArrayNodeDefinition $node): vo
484495
->end()
485496
->end()
486497
->end()
487-
->arrayNode('widgetsRight')
498+
->arrayNode('widgets_right')
488499
->useAttributeAsKey('id')
489500
->scalarPrototype()
490501
->validate()
@@ -493,7 +504,7 @@ private function addPerspectivesConfigurationNode(ArrayNodeDefinition $node): vo
493504
->end()
494505
->end()
495506
->end()
496-
->arrayNode('widgetsBottom')
507+
->arrayNode('widgets_bottom')
497508
->useAttributeAsKey('id')
498509
->scalarPrototype()
499510
->validate()
@@ -502,15 +513,15 @@ private function addPerspectivesConfigurationNode(ArrayNodeDefinition $node): vo
502513
->end()
503514
->end()
504515
->end()
505-
->scalarNode('expandedLeft')
516+
->scalarNode('expanded_left')
506517
->info('The id of the widget that should be expanded on the left side.')
507518
->defaultNull()
508519
->end()
509-
->scalarNode('expandedRight')
520+
->scalarNode('expanded_right')
510521
->info('The id of the widget that should be expanded on the right side.')
511522
->defaultNull()
512523
->end()
513-
->arrayNode('contextPermissions')
524+
->arrayNode('context_permissions')
514525
->useAttributeAsKey('key')
515526
->arrayPrototype()
516527
->useAttributeAsKey('key')
@@ -536,18 +547,23 @@ private function addElementTreeWidgetConfigurationNode(ArrayNodeDefinition $node
536547
->defaultValue([])
537548
->useAttributeAsKey('id')
538549
->arrayPrototype()
550+
->beforeNormalization()
551+
->always(fn (mixed $v) => is_array($v)
552+
? ConfigKeyMapper::convertKeysForConfig($v)
553+
: $v)
554+
->end()
539555
->children()
540556
->scalarNode('name')
541557
->isRequired()
542558
->end()
543-
->scalarNode('elementType')
559+
->scalarNode('element_type')
544560
->defaultValue(ElementTypes::TYPE_OBJECT)
545561
->end()
546-
->scalarNode('pageSize')
562+
->scalarNode('page_size')
547563
->defaultNull()
548564
->validate()
549565
->ifTrue(fn ($v) => !is_null($v) && !is_int($v))
550-
->thenInvalid('The "pageSize" must be an integer or null.')
566+
->thenInvalid('The "page_size" must be an integer or null.')
551567
->end()
552568
->end()
553569
->arrayNode('icon')
@@ -570,11 +586,11 @@ private function addElementTreeWidgetConfigurationNode(ArrayNodeDefinition $node
570586
->end()
571587
->end()
572588
->end()
573-
->scalarNode('rootFolder')
589+
->scalarNode('root_folder')
574590
->defaultValue('/')
575591
->isRequired()
576592
->end()
577-
->booleanNode('showRoot')
593+
->booleanNode('show_root')
578594
->defaultFalse()
579595
->end()
580596
->arrayNode('classes')
@@ -589,7 +605,7 @@ private function addElementTreeWidgetConfigurationNode(ArrayNodeDefinition $node
589605
->scalarNode('pql')
590606
->defaultNull()
591607
->end()
592-
->arrayNode('contextPermissions')
608+
->arrayNode('context_permissions')
593609
->scalarPrototype()
594610
->validate()
595611
->ifNotInArray([true, false])
@@ -705,7 +721,7 @@ private function addGdprDataExtractorNode(ArrayNodeDefinition $node): void
705721
->arrayNode('gdpr_data_extractor')
706722
->addDefaultsIfNotSet()
707723
->children()
708-
->arrayNode('dataObjects')
724+
->arrayNode('data_objects')
709725
->addDefaultsIfNotSet()
710726
->info('Settings for DataObjects DataProvider')
711727
->children()
@@ -714,8 +730,13 @@ private function addGdprDataExtractorNode(ArrayNodeDefinition $node): void
714730
->useAttributeAsKey('name')
715731
->defaultValue([])
716732
->arrayPrototype()
733+
->beforeNormalization()
734+
->always(fn (mixed $v) => is_array($v)
735+
? ConfigKeyMapper::convertKeysForConfig($v)
736+
: $v)
737+
->end()
717738
->children()
718-
->booleanNode('allowDelete')
739+
->booleanNode('allow_delete')
719740
->info('Allow delete of objects directly in preview grid.')
720741
->defaultFalse()
721742
->end()

src/DependencyInjection/PimcoreStudioBackendExtension.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use Pimcore\Bundle\StudioBackendBundle\Twig\Initializers\SandboxExtensionInitializerInterface;
4242
use Pimcore\Bundle\StudioBackendBundle\User\Service\KeyBindingServiceInterface;
4343
use Pimcore\Bundle\StudioBackendBundle\User\Service\MailServiceInterface;
44+
use Pimcore\Bundle\StudioBackendBundle\Util\Config\ConfigKeyMapper;
4445
use Symfony\Component\Config\FileLocator;
4546
use Symfony\Component\DependencyInjection\ContainerBuilder;
4647
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@@ -165,8 +166,10 @@ public function load(array $configs, ContainerBuilder $container): void
165166
'$storageConfig' => $config['config_location'][Configuration::TREE_WIDGETS_NODE],
166167
]);
167168

168-
$defaultPerspective = $this->getParsedConfig(
169-
__DIR__ . '/../../config/pimcore/default_perspective.yaml'
169+
$defaultPerspective = ConfigKeyMapper::convertKeysForApp(
170+
$this->getParsedConfig(
171+
__DIR__ . '/../../config/pimcore/default_perspective.yaml'
172+
)
170173
);
171174

172175
$definition = $container->getDefinition(PerspectiveConfigRepositoryInterface::class);

src/Gdpr/Provider/DataObjectProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
private ObjectExporterInterface $objectExporter,
4040
array $gdprConfig = []
4141
) {
42-
$this->dataObjectConfig = $gdprConfig['dataObjects'] ?? [];
42+
$this->dataObjectConfig = $gdprConfig['data_objects'] ?? [];
4343
}
4444

4545
/**

0 commit comments

Comments
 (0)