Skip to content

Commit 64f9d83

Browse files
committed
Merge pull request #186 from symfony-cmf/issue_130
Deprecate TranslatableExtension in favor of SonataTranslationBundle
2 parents e2455b7 + 006ff79 commit 64f9d83

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

Admin/Extension/TranslatableExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* Admin extension to add publish workflow time period fields.
2222
*
2323
* @author David Buchmann <[email protected]>
24+
*
25+
* @deprecated Since version 1.3, to be removed in 2.0. Use the SonataTranslationBundle instead.
2426
*/
2527
class TranslatableExtension extends AdminExtension
2628
{
@@ -40,6 +42,8 @@ class TranslatableExtension extends AdminExtension
4042
*/
4143
public function __construct($locales, $formGroup = 'form.group_general')
4244
{
45+
@trigger_error('The '.__CLASS__.' class is deprecated since version 1.3 and will be removed in 2.0. Use the SonataTranslationBundle instead.', E_USER_DEPRECATED);
46+
4347
$this->locales = $locales;
4448
$this->formGroup = $formGroup;
4549
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Changelog
22
=========
33

4+
* **2016-01-24**: The `TranslatableExtension` and `cmf_core.admin_extension.translatable` services are deprecated in favor of the SonataTranslationBundle
45
* **2015-04-12**: [BC BREAK] The following services were made private: `cmf_core.admin_extension.child`, `cmf_core.security.publishable_voter`, `cmf_core.security.publish_time_period_voter`, `cmf_core.security.published_voter`, `cmf_core.admin_extension.publish_workflow.publishable`, `cmf_core.admin_extension.publish_workflow.time_period`, `cmf_core.twig.children_extension`, `cmf_core.templating.helper`, `cmf_core.persistence.phpcr.non_translatable_metadata_listener`, `cmf_core.persistence.phpcr.translatable_metadata_listener`, `cmf_core.admin_extension.translatable`
56
* **2015-04-12**: The following services could not be private, but should be considered as such: `cmf_core.publish_workflow.request_listener`, `cmf_core.form.type.checkbox_url_label`
67

DependencyInjection/CmfCoreExtension.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ public function prepend(ContainerBuilder $container)
3737
$config = $this->processConfiguration(new Configuration(), $configs);
3838

3939
$extensions = $container->getExtensions();
40-
if (isset($config['multilang']['locales'])) {
41-
$prependConfig = array('multilang' => $config['multilang']);
42-
if (isset($extensions['cmf_routing'])) {
43-
$container->prependExtensionConfig('cmf_routing', array('dynamic' => $prependConfig['multilang']));
44-
}
40+
if (isset($config['multilang']['locales']) && isset($extensions['cmf_routing'])) {
41+
$container->prependExtensionConfig('cmf_routing', array(
42+
'dynamic' => array('locales' => $config['multilang']['locales']),
43+
));
4544
}
4645

4746
if ($config['persistence']['phpcr']) {
@@ -63,6 +62,7 @@ public function prepend(ContainerBuilder $container)
6362
),
6463
),
6564
);
65+
6666
break;
6767
case 'cmf_content':
6868
$prependConfig = array(
@@ -74,6 +74,7 @@ public function prepend(ContainerBuilder $container)
7474
),
7575
),
7676
);
77+
7778
break;
7879
case 'cmf_create':
7980
$prependConfig = array(
@@ -91,6 +92,7 @@ public function prepend(ContainerBuilder $container)
9192
'basepath' => $persistenceConfig['basepath'].'/media',
9293
);
9394
}
95+
9496
break;
9597
case 'cmf_media':
9698
$prependConfig = array(
@@ -102,6 +104,7 @@ public function prepend(ContainerBuilder $container)
102104
),
103105
),
104106
);
107+
105108
break;
106109
case 'cmf_menu':
107110
$prependConfig = array(
@@ -115,6 +118,7 @@ public function prepend(ContainerBuilder $container)
115118
),
116119
),
117120
);
121+
118122
break;
119123
case 'cmf_routing':
120124
$routePaths = array($persistenceConfig['basepath'].'/routes');
@@ -136,6 +140,7 @@ public function prepend(ContainerBuilder $container)
136140
if (isset($bundles['CmfContentBundle'])) {
137141
$prependConfig['dynamic']['generic_controller'] = 'cmf_content.controller:indexAction';
138142
}
143+
139144
break;
140145
case 'cmf_routing_auto':
141146
$prependConfig = array(
@@ -146,6 +151,7 @@ public function prepend(ContainerBuilder $container)
146151
),
147152
),
148153
);
154+
149155
break;
150156
case 'cmf_search':
151157
$prependConfig = array(
@@ -161,6 +167,7 @@ public function prepend(ContainerBuilder $container)
161167
if (!empty($persistenceConfig['translation_strategy'])) {
162168
$prependConfig['persistence']['phpcr']['translation_strategy'] = $persistenceConfig['translation_strategy'];
163169
}
170+
164171
break;
165172
case 'cmf_simple_cms':
166173
$prependConfig = array(
@@ -174,6 +181,7 @@ public function prepend(ContainerBuilder $container)
174181
),
175182
),
176183
);
184+
177185
break;
178186
case 'cmf_tree_browser':
179187
$prependConfig = array(
@@ -183,6 +191,7 @@ public function prepend(ContainerBuilder $container)
183191
),
184192
),
185193
);
194+
186195
break;
187196
case 'cmf_seo':
188197
$prependConfig = array(
@@ -195,6 +204,7 @@ public function prepend(ContainerBuilder $container)
195204
'enabled' => $persistenceConfig['use_sonata_admin'],
196205
),
197206
);
207+
198208
break;
199209
}
200210

Tests/Unit/Admin/Extension/TranslatableExtensionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Cmf\Bundle\CoreBundle\Admin\Extension\TranslatableExtension;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class TranslatableExtensionTest extends \PHPUnit_Framework_TestCase
1720
{
1821
public function setUp()

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"symfony/security-bundle": "To be able to use the publish workflow system (^2.1)",
3131
"symfony-cmf/routing": "To be able to use the CMF twig extension functions cmf_prev_linkable/cmf_next_linkable (^1.2)",
3232
"symfony-cmf/routing-bundle": "To be able to enable the publish_workflow_listener (^1.2)",
33-
"sonata-project/admin-bundle": "To be able to enable the publish_workflow_listener extension (^2.2)"
33+
"sonata-project/admin-bundle": "To be able to enable the publish_workflow_listener extension (^2.2)",
34+
"sonata-project/translation-bundle": "To be able to edit translatable documents (^1.0)"
3435
},
3536
"autoload": {
3637
"psr-4": {

0 commit comments

Comments
 (0)