Skip to content

Commit ef045f3

Browse files
committed
feat(config): rename YAML keys to default_profile/profiles; prepare release 1.2.0
Prefer AuditKit-style profile keys while keeping legacy default_config/configs via normalization and container parameter aliases.
1 parent 4922965 commit ef045f3

15 files changed

Lines changed: 158 additions & 71 deletions

File tree

.symfony/recipe/nowo-tech/ckeditor5-editor-bundle/1.0/config/packages/nowo_ckeditor5_editor.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
nowo_ckeditor5_editor:
2-
default_config: default
3-
configs:
2+
default_profile: default
3+
profiles:
44
default:
55
preset: standard
66
toolbar: true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ php bin/console assets:install public
3636
```yaml
3737
# config/packages/nowo_ckeditor5_editor.yaml
3838
nowo_ckeditor5_editor:
39-
default_config: simple
40-
configs:
39+
default_profile: simple
40+
profiles:
4141
simple:
4242
preset: simple
4343
toolbar: true

demo/symfony8/config/packages/nowo_ckeditor5_editor.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# min_height: CSS value; use %demo.ckeditor.height.*% or %env(DEMO_CKEDITOR_FOLIO_MIN_HEIGHT)% (see .env)
66

77
nowo_ckeditor5_editor:
8-
default_config: simple
9-
configs:
8+
default_profile: simple
9+
profiles:
1010
full:
1111
preset: standard
1212
toolbar: true

demo/symfony8/config/reference.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,8 @@
749749
* excluded_ajax_paths?: scalar|Param|null, // Default: "^/((index|app(_[\\w]+)?)\\.php/)?_wdt"
750750
* }
751751
* @psalm-type NowoCkeditor5EditorConfig = array{
752-
* default_config?: scalar|Param|null, // Profile name used when the form field omits the "config" option. // Default: "default"
753-
* configs?: array<string, array{ // Default: []
752+
* default_profile?: scalar|Param|null, // Profile name used when the form field omits the "config" option. // Default: "default"
753+
* profiles?: array<string, array{ // Default: []
754754
* toolbar?: bool|Param, // When true, CKEditor shows its toolbar (preset still controls which buttons are available). // Default: true
755755
* min_height?: scalar|Param|null, // Default CSS min-height for the editable region wrapper (e.g. 240px, 12rem). // Default: "240px"
756756
* form_theme?: scalar|Param|null, // Base Symfony form layout (must match twig.form_themes in your app). // Default: "form_div_layout.html.twig"

docs/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.0] - 2026-07-18
11+
12+
### Changed
13+
14+
- Configuration: renamed YAML keys **`default_config`** / **`configs`** to **`default_profile`** / **`profiles`** (AuditKit-style). Legacy keys still accepted via normalization; container parameters keep legacy aliases. Form option `config` unchanged. See [`UPGRADING.md`](UPGRADING.md) and [`CONFIGURATION.md`](CONFIGURATION.md).
15+
- Documentation, Flex recipe, demo, and fixtures updated to the new key names.
16+
1017
## [1.1.4] - 2026-07-16
1118

1219
### Added
@@ -102,7 +109,8 @@ First semver release (documented stable line, CI and Packagist aligned with tag
102109
- PHPUnit: integration suite + unit test for `upload_url` CSRF branch (**100%** PHP Clover on `src/`).
103110
- PHP-CS-Fixer finder excludes generated integration fixture cache and `tests/Fixtures/app/config/reference.php`.
104111

105-
[Unreleased]: https://github.com/nowo-tech/Ckeditor5EditorBundle/compare/v1.1.4...HEAD
112+
[Unreleased]: https://github.com/nowo-tech/Ckeditor5EditorBundle/compare/v1.2.0...HEAD
113+
[1.2.0]: https://github.com/nowo-tech/Ckeditor5EditorBundle/compare/v1.1.4...v1.2.0
106114
[1.1.4]: https://github.com/nowo-tech/Ckeditor5EditorBundle/compare/v1.1.3...v1.1.4
107115
[1.1.3]: https://github.com/nowo-tech/Ckeditor5EditorBundle/compare/v1.1.2...v1.1.3
108116
[1.1.2]: https://github.com/nowo-tech/Ckeditor5EditorBundle/compare/v1.1.1...v1.1.2

docs/CONFIGURATION.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Root key: `nowo_ckeditor5_editor`
44

55
## Top-level
66

7-
| Option | Type | Default | Description |
8-
| ---------------- | ------ | --------- | ----------- |
9-
| `default_config` | string | `default` | Profile name when a form field omits the `config` option. **Must** exist under `configs`. |
10-
| `configs` | map || Named profiles. At least one profile is required (or use [legacy flat](#legacy-flat-yaml) input). |
7+
| Option | Type | Default | Description |
8+
| ----------------- | ------ | --------- | ----------- |
9+
| `default_profile` | string | `default` | Profile name when a form field omits the `config` option. **Must** exist under `profiles`. |
10+
| `profiles` | map || Named profiles. At least one profile is required (or use [legacy keys and flat YAML](#legacy-keys-and-flat-yaml) input). |
1111

12-
## Per profile (`configs.<name>`)
12+
## Per profile (`profiles.<name>`)
1313

1414
| Option | Type | Default | Description |
1515
| ------------- | ------ | --------------------------- | ----------- |
@@ -21,17 +21,18 @@ Root key: `nowo_ckeditor5_editor`
2121
| `theme` | string | `light` | Chrome palette: `light`, `dark`, or `auto`. |
2222
| `upload_url` | string | `null` | Optional URL for Simple Upload Adapter (demo/apps provide POST endpoints). |
2323

24-
## Legacy flat YAML
24+
## Legacy keys and flat YAML
2525

26-
If the root has no `configs` key, the extension maps flat keys into a single profile under `configs` using `default_config` (default `default`):
26+
- **Renamed keys:** `default_config` / `configs` were renamed to `default_profile` / `profiles`. Legacy keys are still accepted via normalization (mapped when the new keys are absent).
27+
- **Flat layout:** If the root has no `profiles` (nor legacy `configs`) key, the extension maps flat keys into a single profile under `profiles` using `default_profile` (default `default`):
2728

2829
- `toolbar`, `min_height`, `form_theme`, `debug`, `preset`, `theme`, `upload_url`
2930

3031
## Form type `Ckeditor5EditorType` options
3132

3233
| Option | Type | Description |
3334
| --------------- | ---- | ----------- |
34-
| `config` | `string\|null` | Profile name under `nowo_ckeditor5_editor.configs`. `null`/empty uses `default_config`. |
35+
| `config` | `string\|null` | Profile name under `nowo_ckeditor5_editor.profiles`. `null`/empty uses `default_profile`. (Form option key remains `config` for BC.) |
3536
| `editor_config` | `array` | Keys merged over the YAML profile: `toolbar`, `min_height`, `form_theme`, `debug`, `preset`, `theme`, `upload_url`. |
3637
| `toolbar` | bool | Field-level override. |
3738
| `min_height` | string | Field-level override. |
@@ -59,4 +60,4 @@ Translations use the domain **`NowoCkeditor5EditorBundle`** (`src/Resources/tran
5960

6061
## Parameters exposed to the container
6162

62-
The DI extension sets parameters from configuration (including backward-compatible scalars for the **default** profile). Prefer resolving behaviour through `Ckeditor5EditorType` and YAML profiles.
63+
The DI extension sets `nowo_ckeditor5_editor.default_profile` and `nowo_ckeditor5_editor.profiles`, plus legacy aliases `nowo_ckeditor5_editor.default_config` / `nowo_ckeditor5_editor.configs` (same values), and backward-compatible scalars for the **default** profile. Prefer resolving behaviour through `Ckeditor5EditorType` and YAML profiles.

docs/INSTALLATION.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Create configuration (recommended — named profiles):
2828
```yaml
2929
# config/packages/nowo_ckeditor5_editor.yaml
3030
nowo_ckeditor5_editor:
31-
default_config: simple
32-
configs:
31+
default_profile: simple
32+
profiles:
3333
simple:
3434
preset: simple
3535
toolbar: true
@@ -39,7 +39,7 @@ nowo_ckeditor5_editor:
3939
theme: light
4040
```
4141
42-
You may use **legacy flat** keys at the root (without `configs`): they are normalized into `configs.default`. Prefer explicit `configs` for multiple profiles.
42+
You may use **legacy flat** keys at the root (without `profiles`): they are normalized into `profiles.default`. Prefer explicit `profiles` for multiple profiles. Legacy YAML keys `default_config` / `configs` are still accepted and mapped to `default_profile` / `profiles`.
4343

4444
See [CONFIGURATION.md](CONFIGURATION.md) for the full reference.
4545

docs/UPGRADING.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,43 @@ Patch release: repository tooling (CodeRabbit, Spec Kit, Cursor rules), CI **`gi
9696

9797
See [`CHANGELOG.md`](CHANGELOG.md) (section **1.1.4**).
9898

99+
## To 1.2.0 from 1.1.4
100+
101+
Minor release: YAML keys **`default_config`** / **`configs`** renamed to **`default_profile`** / **`profiles`** (AuditKit-style). Prefer the new names in app config.
102+
103+
**Before (≤ 1.1.4):**
104+
105+
```yaml
106+
nowo_ckeditor5_editor:
107+
default_config: simple
108+
configs:
109+
simple:
110+
preset: simple
111+
```
112+
113+
**After (1.2.0+):**
114+
115+
```yaml
116+
nowo_ckeditor5_editor:
117+
default_profile: simple
118+
profiles:
119+
simple:
120+
preset: simple
121+
```
122+
123+
- Legacy keys are still accepted via `beforeNormalization` when the new keys are absent.
124+
- Container parameters `nowo_ckeditor5_editor.default_config` / `nowo_ckeditor5_editor.configs` remain as aliases of the new parameters.
125+
- Form option key **`config`** is unchanged.
126+
- **Composer**: `composer update nowo-tech/ckeditor5-editor-bundle` (with `^1.0` or `^1.2`); then `php bin/console cache:clear`.
127+
128+
See [`CHANGELOG.md`](CHANGELOG.md) (section **1.2.0**) and [`CONFIGURATION.md`](CONFIGURATION.md).
129+
99130
## To 1.x (first documented stable line)
100131

101132
When upgrading from snapshots without semver tags in your project:
102133

103134
- **Composer**: `composer require nowo-tech/ckeditor5-editor-bundle:^1.0`
104-
- **Configuration**: prefer explicit **`configs`** + **`default_config`** (see [`CONFIGURATION.md`](CONFIGURATION.md)). Legacy flat YAML under `nowo_ckeditor5_editor` is still accepted and normalized.
135+
- **Configuration**: prefer explicit **`profiles`** + **`default_profile`** (see [`CONFIGURATION.md`](CONFIGURATION.md)). Legacy keys `default_config` / `configs` and flat YAML under `nowo_ckeditor5_editor` are still accepted and normalized.
105136
- **Bootstrap**: ensure your layout loads the bundle script once per page:
106137

107138
```twig

src/DependencyInjection/Configuration.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
/**
1717
* Named profiles (toolbar, min_height, form_theme, debug, preset, theme) plus default profile key.
1818
*
19+
* Legacy YAML keys `default_config` / `configs` are accepted and mapped to `default_profile` / `profiles`.
20+
* Flat options under the root are normalized into `profiles.default`.
21+
*
1922
* @author Héctor Franco Aceituno <hectorfranco@nowo.tech>
2023
*/
2124
final class Configuration implements ConfigurationInterface
@@ -33,32 +36,42 @@ public function getConfigTreeBuilder(): TreeBuilder
3336
if (!is_array($v)) {
3437
return $v;
3538
}
36-
if (isset($v['configs'])) {
39+
40+
if (!isset($v['profiles']) && isset($v['configs'])) {
41+
$v['profiles'] = $v['configs'];
42+
unset($v['configs']);
43+
}
44+
if (!isset($v['default_profile']) && isset($v['default_config'])) {
45+
$v['default_profile'] = $v['default_config'];
46+
unset($v['default_config']);
47+
}
48+
49+
if (isset($v['profiles'])) {
3750
return $v;
3851
}
3952

40-
$defaultConfig = $v['default_config'] ?? 'default';
41-
$profile = [];
53+
$defaultProfile = $v['default_profile'] ?? 'default';
54+
$profile = [];
4255
foreach (['toolbar', 'min_height', 'form_theme', 'debug', 'preset', 'theme', 'upload_url'] as $key) {
4356
if (array_key_exists($key, $v)) {
4457
$profile[$key] = $v[$key];
4558
}
4659
}
4760

4861
return [
49-
'default_config' => $defaultConfig,
50-
'configs' => [
62+
'default_profile' => $defaultProfile,
63+
'profiles' => [
5164
'default' => $profile,
5265
],
5366
];
5467
})
5568
->end()
5669
->children()
57-
->scalarNode('default_config')
70+
->scalarNode('default_profile')
5871
->defaultValue('default')
59-
->info('Profile name used when the form field omits the "config" option.')
72+
->info('Profile name used when the form field omits the "config" option (form option key remains "config" for BC).')
6073
->end()
61-
->arrayNode('configs')
74+
->arrayNode('profiles')
6275
->info('Named profiles; each field may reference one via the "config" form option.')
6376
->useAttributeAsKey('name')
6477
->requiresAtLeastOneElement()
@@ -106,8 +119,8 @@ public function getConfigTreeBuilder(): TreeBuilder
106119
->end()
107120
->validate()
108121
->always(static function (array $v): array {
109-
if (!isset($v['configs'][$v['default_config']])) {
110-
throw new InvalidConfigurationException(sprintf('nowo_ckeditor5_editor.default_config ("%s") must exist in nowo_ckeditor5_editor.configs (keys: %s).', $v['default_config'], implode(', ', array_keys($v['configs']))));
122+
if (!isset($v['profiles'][$v['default_profile']])) {
123+
throw new InvalidConfigurationException(sprintf('nowo_ckeditor5_editor.default_profile ("%s") must exist in nowo_ckeditor5_editor.profiles (keys: %s).', $v['default_profile'], implode(', ', array_keys($v['profiles']))));
111124
}
112125

113126
return $v;

src/DependencyInjection/NowoCkeditor5EditorExtension.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ public function load(array $configs, ContainerBuilder $container): void
3838
$loader->load('services.yaml');
3939

4040
$config = $this->processConfiguration(new Configuration(), $configs);
41-
$defaultName = $config['default_config'];
42-
$defaultProfile = $config['configs'][$defaultName];
41+
$defaultName = $config['default_profile'];
42+
$defaultProfile = $config['profiles'][$defaultName];
4343

44+
$container->setParameter(Configuration::ALIAS . '.default_profile', $defaultName);
45+
$container->setParameter(Configuration::ALIAS . '.profiles', $config['profiles']);
46+
// Legacy parameter names (same values) for BC.
4447
$container->setParameter(Configuration::ALIAS . '.default_config', $defaultName);
45-
$container->setParameter(Configuration::ALIAS . '.configs', $config['configs']);
48+
$container->setParameter(Configuration::ALIAS . '.configs', $config['profiles']);
4649

4750
$container->setParameter(Configuration::ALIAS . '.toolbar', $defaultProfile['toolbar']);
4851
$container->setParameter(Configuration::ALIAS . '.min_height', $defaultProfile['min_height']);
@@ -71,7 +74,7 @@ public function prepend(ContainerBuilder $container): void
7174
}
7275

7376
$configs = $container->getExtensionConfig(Configuration::ALIAS);
74-
/** @var array{default_config: string, configs: array<string, array<string, mixed>>} $config */
77+
/** @var array{default_profile: string, profiles: array<string, array<string, mixed>>} $config */
7578
$config = $this->processConfiguration(new Configuration(), $configs);
7679

7780
$themePaths = $this->orderedFormThemePaths($config);
@@ -81,19 +84,19 @@ public function prepend(ContainerBuilder $container): void
8184
}
8285

8386
/**
84-
* @param array{default_config: string, configs: array<string, array<string, mixed>>} $processedConfig
87+
* @param array{default_profile: string, profiles: array<string, array<string, mixed>>} $processedConfig
8588
*
8689
* @return list<string>
8790
*/
8891
private function orderedFormThemePaths(array $processedConfig): array
8992
{
90-
$configs = $processedConfig['configs'];
91-
$defaultName = $processedConfig['default_config'];
92-
$defaultTheme = $configs[$defaultName]['form_theme'] ?? 'form_div_layout.html.twig';
93+
$profiles = $processedConfig['profiles'];
94+
$defaultName = $processedConfig['default_profile'];
95+
$defaultTheme = $profiles[$defaultName]['form_theme'] ?? 'form_div_layout.html.twig';
9396
$defaultPath = self::FORM_THEME_MAP[$defaultTheme] ?? self::FORM_THEME_MAP['form_div_layout.html.twig'];
9497

9598
$unique = [];
96-
foreach ($configs as $profile) {
99+
foreach ($profiles as $profile) {
97100
$ft = $profile['form_theme'] ?? 'form_div_layout.html.twig';
98101
$p = self::FORM_THEME_MAP[$ft] ?? self::FORM_THEME_MAP['form_div_layout.html.twig'];
99102
$unique[$p] = true;

0 commit comments

Comments
 (0)