diff --git a/app/config/default_parameters.yml b/app/config/default_parameters.yml index 15aab2497..8de325564 100644 --- a/app/config/default_parameters.yml +++ b/app/config/default_parameters.yml @@ -132,6 +132,11 @@ parameters: app.search.list.limit: 10 app.search.list.content_types: ['article', 'place', 'blog_post', 'product'] + app.migration_reference_file: '/src/AppBundle/MigrationVersions/References/references_all.yml' + + app.migration.values_mapping: + userprofiling_block.config.tags_subtree_limit: 'ref_tag_user_segments' + #menu.default.menucontentsettings.topidentifierlist: [landing_page, blog, about, subscribe, product_list] menu.default.menucontentsettings.topidentifierlist: [landing_page, folder, blog, about, subscribe, product_list] @@ -147,3 +152,4 @@ parameters: eztags.default.tag_view.pagelayout: '::pagelayout.html.twig' userprofiling_block.public_dir: 'bundles/app' + userprofiling_block.config.tags_subtree_limit: 513 diff --git a/app/config/services/app.yml b/app/config/services/app.yml index aa975f414..ccf390f00 100644 --- a/app/config/services/app.yml +++ b/app/config/services/app.yml @@ -127,3 +127,10 @@ services: - '@ezpublish.api.service.tags' tags: - { name: landing_page_field_type.block_type, alias: userprofiling } + + # User Profiling configuration provider + EzSystems\EzPlatformAdminUi\UI\Config\Provider\Value: + arguments: + - '%userprofiling_block.config.tags_subtree_limit%' + tags: + - { name: ezplatform.admin_ui.config_provider, key: 'userProfilingBlockSubTreeLimit' } diff --git a/src/AppBundle/AppBundle.php b/src/AppBundle/AppBundle.php index 05123b678..c92c72d55 100644 --- a/src/AppBundle/AppBundle.php +++ b/src/AppBundle/AppBundle.php @@ -2,8 +2,15 @@ namespace AppBundle; +use AppBundle\DependencyInjection\Compiler\MigrationParameterPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; class AppBundle extends Bundle { + public function build(ContainerBuilder $container) + { + parent::build($container); + $container->addCompilerPass(new MigrationParameterPass()); + } } diff --git a/src/AppBundle/DependencyInjection/Compiler/MigrationParameterPass.php b/src/AppBundle/DependencyInjection/Compiler/MigrationParameterPass.php new file mode 100644 index 000000000..6483da28d --- /dev/null +++ b/src/AppBundle/DependencyInjection/Compiler/MigrationParameterPass.php @@ -0,0 +1,36 @@ +getParameter('kernel.project_dir') . $container->getParameter('app.migration_reference_file'); + $migrationValuesMapping = $container->getParameter('app.migration.values_mapping'); + + if (!is_readable($referenceFile)) { + return; + } + + $references = Yaml::parseFile($referenceFile); + + foreach ($migrationValuesMapping as $parameterName => $migrationParameterName) { + if (!array_key_exists($migrationParameterName, $references)) { + continue; + } + + $container->setParameter($parameterName, $references[$migrationParameterName]); + } + } +} diff --git a/src/AppBundle/MigrationVersions/users.yml b/src/AppBundle/MigrationVersions/users.yml index 82c893780..71195ed2d 100644 --- a/src/AppBundle/MigrationVersions/users.yml +++ b/src/AppBundle/MigrationVersions/users.yml @@ -125,13 +125,9 @@ field-settings: hideRootTag: false editView: Default -# subTreeLimit: reference:ref_tag_user_segments validator-configuration: TagsValueValidator: - # TODO: change to reference when merged https://github.com/kaliop-uk/ezmigrationbundle/pull/133 - subTreeLimit: 513 - #subTreeLimit: reference:ref_tag_user_segments - #subTreeLimit: tag_keyword:'User Segments' + subTreeLimit: reference:ref_tag_user_segments references: - identifier: ref_content_type_id__user diff --git a/src/AppBundle/Resources/public/js/views/up-itemsfieldview.js b/src/AppBundle/Resources/public/js/views/up-itemsfieldview.js index bf54e11e8..9ee9ce048 100644 --- a/src/AppBundle/Resources/public/js/views/up-itemsfieldview.js +++ b/src/AppBundle/Resources/public/js/views/up-itemsfieldview.js @@ -134,7 +134,7 @@ YUI.add('up-itemsfieldview', function (Y) { jQuery(selector).EzTags({ autocompleteUrl: window.Routing.generate('netgen_tags_admin_autocomplete'), maxTags: 1, - subtreeLimit: 513, + subtreeLimit: window.eZ.adminUiConfig.userProfilingBlockSubTreeLimit, hideRootTag: 1, sortable: false, translations: {