diff --git a/src/bundle/Controller/LocationController.php b/src/bundle/Controller/LocationController.php index c775e04484..312dc9553b 100644 --- a/src/bundle/Controller/LocationController.php +++ b/src/bundle/Controller/LocationController.php @@ -297,7 +297,7 @@ public function swapAction(Request $request): Response $currentLocation = $data->getCurrentLocation(); $newLocation = $data->getNewLocation(); - $childCount = $this->locationService->getLocationChildCount($currentLocation); + $childCount = $this->locationService->getLocationChildCount($currentLocation, 1); $contentType = $newLocation->getContent()->getContentType(); if (!$contentType->isContainer && $childCount) { diff --git a/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php b/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php index 208c8d62a3..fd9aab6e32 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php @@ -30,17 +30,23 @@ class SubtreeOperations extends AbstractParser /** * @inheritdoc */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void + public function mapConfig(array & $scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { - if (!isset($scopeSettings['subtree_operations']['copy_subtree']['limit'])) { - return; + if (isset($scopeSettings['subtree_operations']['copy_subtree']['limit'])) { + $contextualizer->setContextualParameter( + 'subtree_operations.copy_subtree.limit', + $currentScope, + $scopeSettings['subtree_operations']['copy_subtree']['limit'] + ); } - $contextualizer->setContextualParameter( - 'subtree_operations.copy_subtree.limit', - $currentScope, - $scopeSettings['subtree_operations']['copy_subtree']['limit'] - ); + if (isset($scopeSettings['subtree_operations']['query_subtree']['limit'])) { + $contextualizer->setContextualParameter( + 'subtree_operations.query_subtree.limit', + $currentScope, + $scopeSettings['subtree_operations']['query_subtree']['limit'] + ); + } } public function addSemanticConfig(NodeBuilder $nodeBuilder): void @@ -57,6 +63,14 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void ->end() ->end() ->end() + ->arrayNode('query_subtree') + ->children() + ->integerNode('limit') + ->info('Limit the total count of items queried for when calculating the the number of direct children a node has. -1 for no limit. Default is 500 for performance reasons.') + ->defaultValue(500) + ->isRequired() + ->end() + ->end() ->end() ->end(); } diff --git a/src/bundle/Resources/config/ezplatform_default_settings.yaml b/src/bundle/Resources/config/ezplatform_default_settings.yaml index b6921dc51b..8180ec8acb 100644 --- a/src/bundle/Resources/config/ezplatform_default_settings.yaml +++ b/src/bundle/Resources/config/ezplatform_default_settings.yaml @@ -41,6 +41,7 @@ parameters: # Subtree Operations ezsettings.admin_group.subtree_operations.copy_subtree.limit: 100 + ezsettings.admin_group.subtree_operations.query_subtree.limit: 500 # Notifications ezsettings.admin_group.notifications.error.timeout: 0 diff --git a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig index e56ff84288..42f58d13c7 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig @@ -34,7 +34,7 @@ {% include '@ezdesign/ui/location_path.html.twig' with {'locations': location.pathLocations, 'link_last_element': true} %} - {{ location.childCount }} + {% if sub_item_query_limit is not null and location.childCount > sub_item_query_limit %}{{ location.childCount -1 }}+{% else %}{{location.childCount}}{% endif %}