From 6d6c1db097d096d3147a02f72c26cb80ebcd2029 Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Wed, 6 Dec 2023 18:54:26 +0100 Subject: [PATCH] Implement a "needed properties collector" for: The current definition formatter & actions --- .../AbstractListShowAllHandler.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php index e97cbc46..6b87bc39 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/AbstractListShowAllHandler.php @@ -449,12 +449,37 @@ protected function loadCollection(EnvironmentInterface $environment) $listingConfig = $this->getViewSection($definition)->getListingConfig(); $panel = $view->getPanel(); assert($panel instanceof PanelContainerInterface); - ViewHelpers::initializeSorting($panel, $dataConfig, $listingConfig); $provider = $environment->getDataProvider(); assert($provider instanceof DataProviderInterface); + // FIXME: implement a "needed properties collector" for: The current definition formatter & actions. + // Fetch only desired properties. + /* + if ($listingConfig->hasLabelFormatter($definition->getName())) { + $properties = $listingConfig->getLabelFormatter($definition->getName())->getPropertyNames(); + $properties = array_merge($properties, ['id', 'tstamp', 'pid', 'enabled']); + $properties = array_filter( + $properties, + function (string $propertyName) use ($provider): bool { + if ($provider->fieldExists($propertyName)) { + return true; + } + // @codingStandardsIgnoreStart + @\trigger_error( + 'Only real property is allowed in the property definition.' . + 'This will no longer be supported in the future.', + E_USER_DEPRECATED + ); + // @codingStandardsIgnoreEnd + return false; + } + ); + $dataConfig->setFields($properties); + } + */ + return $provider->fetchAll($dataConfig); }