/**
  * Parse the sorting part of listing configuration.
  *
  * @param ListingConfigInterface $listing The listing configuration to be populated.
  *
  * @return void
  */
 protected function parseListLabel(ListingConfigInterface $listing)
 {
     if (($formats = $this->getFromDca('dca_config/child_list')) === null) {
         return;
     }
     foreach ($formats as $providerName => $format) {
         $formatter = new DefaultModelFormatterConfig();
         $configured = false;
         if (isset($format['fields'])) {
             $formatter->setPropertyNames($format['fields']);
             $configured = true;
         }
         if (isset($format['format'])) {
             $formatter->setFormat($format['format']);
             $configured = true;
         }
         if (isset($format['maxCharacters'])) {
             $formatter->setMaxLength($format['maxCharacters']);
             $configured = true;
         }
         if ($configured) {
             $listing->setLabelFormatter($providerName, $formatter);
         }
     }
 }
 /**
  * Parse the sorting part of listing configuration.
  *
  * @param ContainerInterface     $container The container where the data shall be stored.
  *
  * @param ListingConfigInterface $listing   The listing configuration definition to populate.
  *
  * @param array                  $listDca   The DCA part containing the information to use.
  *
  * @return void
  */
 protected function parseListLabel(ContainerInterface $container, ListingConfigInterface $listing, array $listDca)
 {
     $labelDca = isset($listDca['label']) ? $listDca['label'] : array();
     $formatter = new DefaultModelFormatterConfig();
     $configured = false;
     if (isset($labelDca['fields'])) {
         $formatter->setPropertyNames($labelDca['fields']);
         $configured = true;
     }
     if (isset($labelDca['format'])) {
         $formatter->setFormat($labelDca['format']);
         $configured = true;
     }
     if (isset($labelDca['maxCharacters'])) {
         $formatter->setMaxLength($labelDca['maxCharacters']);
         $configured = true;
     }
     if ($configured) {
         $listing->setLabelFormatter($container->getBasicDefinition()->getDataProvider(), $formatter);
     }
     if (isset($labelDca['showColumns'])) {
         $listing->setShowColumns($labelDca['showColumns']);
     }
 }
Пример #3
0
 /**
  * Parse the sorting part of listing configuration.
  *
  * @param IMetaModelDataDefinition $container The data container.
  *
  * @param ListingConfigInterface   $listing   The listing config.
  *
  * @return void
  */
 protected function parseListLabel(IMetaModelDataDefinition $container, ListingConfigInterface $listing)
 {
     $providerName = $container->getBasicDefinition()->getDataProvider();
     if (!$listing->hasLabelFormatter($providerName)) {
         $formatter = new DefaultModelFormatterConfig();
         $listing->setLabelFormatter($container->getBasicDefinition()->getDataProvider(), $formatter);
     } else {
         $formatter = $listing->getLabelFormatter($providerName);
     }
     $formatter->setPropertyNames(array_merge($formatter->getPropertyNames(), $container->getPropertiesDefinition()->getPropertyNames()));
     if (!$formatter->getFormat()) {
         $formatter->setFormat(str_repeat('%s ', count($formatter->getPropertyNames())));
     }
 }