/**
  * Parse the sorting and grouping information for all properties.
  *
  * @param Contao2BackendViewDefinitionInterface $view             The view information for the backend view.
  *
  * @param array                                 $parsedProperties A list of properties already parsed.
  *
  * @return void
  */
 protected function parsePropertySortingAndGroupings($view, $parsedProperties)
 {
     $definitions = $view->getListingConfig()->getGroupAndSortingDefinition();
     foreach ((array) $this->getFromDca('fields') as $propName => $propInfo) {
         $this->parsePropertySortingAndGrouping($propName, $propInfo, $definitions, $parsedProperties);
     }
 }
 /**
  * Parse the listing configuration.
  *
  * @param Contao2BackendViewDefinitionInterface $view The backend view definition.
  *
  * @return void
  */
 protected function parseListing(Contao2BackendViewDefinitionInterface $view)
 {
     $listing = $view->getListingConfig();
     $this->parseListLabel($listing);
 }
 /**
  * Parse the listing configuration.
  *
  * @param ContainerInterface                    $container The container where the data shall be stored.
  *
  * @param Contao2BackendViewDefinitionInterface $view      The view information for the backend view.
  *
  * @return void
  */
 protected function parseListing(ContainerInterface $container, Contao2BackendViewDefinitionInterface $view)
 {
     $listing = $view->getListingConfig();
     $listDca = $this->getFromDca('list');
     if ($listing->getRootLabel() === null && ($label = $this->getFromDca('config/label')) !== null) {
         $listing->setRootLabel($label);
     }
     if ($listing->getRootIcon() === null && ($icon = $this->getFromDca('config/icon')) !== null) {
         $listing->setRootIcon($icon);
     }
     // Cancel if no list configuration found.
     if (!$listDca) {
         return;
     }
     $this->parseListSorting($listing, $listDca);
     $this->parseListLabel($container, $listing, $listDca);
 }
Ejemplo n.º 4
0
 /**
  * Parse the listing configuration.
  *
  * @param IMetaModelDataDefinition              $container The data container.
  *
  * @param Contao2BackendViewDefinitionInterface $view      The view definition.
  *
  * @return void
  */
 protected function parseListing(IMetaModelDataDefinition $container, Contao2BackendViewDefinitionInterface $view)
 {
     $listing = $view->getListingConfig();
     if ($listing->getRootLabel() === null) {
         $listing->setRootLabel($this->getMetaModel()->get('name'));
     }
     if ($listing->getRootIcon() === null && ($inputScreen = $this->getInputScreenDetails()) !== null) {
         $icon = ToolboxFile::convertValueToPath($inputScreen->getIcon());
         // Determine image to use.
         if ($icon && file_exists(TL_ROOT . '/' . $icon)) {
             $event = new ResizeImageEvent($icon, 16, 16);
             $this->serviceContainer->getEventDispatcher()->dispatch(ContaoEvents::IMAGE_RESIZE, $event);
             $icon = $event->getResultImage();
         } else {
             $icon = 'system/modules/metamodels/assets/images/icons/metamodels.png';
         }
         $listing->setRootIcon($icon);
     }
     $this->parseListSorting($listing);
     $this->parseListLabel($container, $listing);
     if ($inputScreen = $this->getInputScreenDetails()) {
         $listing->setShowColumns($inputScreen->isShowColumns());
         $renderSetting = $this->serviceContainer->getService('metamodels-view-combinations')->getRenderSetting($container->getName());
         $metaModel = $this->serviceContainer->getFactory()->getMetaModel($container->getName());
         /** @var $renderSettingCollection \MetaModels\Render\Setting\Collection */
         $renderSettingCollection = $this->serviceContainer->getRenderSettingFactory()->createCollection($metaModel, $renderSetting);
         $listing->getLabelFormatter($container->getName())->setPropertyNames($renderSettingCollection->getSettingNames());
     }
 }