/**
  * Retrieve a list of html buttons to use in the bottom panel (submit area).
  *
  * @return string[]
  */
 private function getEditButtons()
 {
     $buttons = [];
     $buttons['save'] = sprintf('<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="%s" />', $this->translateLabel('save'));
     if ($this->definition->getBasicDefinition()->isCreatable()) {
         $buttons['saveNcreate'] = sprintf('<input type="submit" name="saveNcreate" id="saveNcreate" class="tl_submit" accesskey="n" ' . ' value="%s" />', $this->translateLabel('saveNcreate'));
     }
     $event = new GetEditModeButtonsEvent($this->environment);
     $event->setButtons($buttons);
     $this->dispatcher->dispatch($event::NAME, $event);
     return $event->getButtons();
 }
 /**
  * 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']);
     }
 }
 /**
  * Parse the root condition.
  *
  * @param ContainerInterface                   $container  The container where the data shall be stored.
  *
  * @param ModelRelationshipDefinitionInterface $definition The relationship definition.
  *
  * @return void
  *
  * @throws DcGeneralRuntimeException If no root data provider is defined.
  */
 protected function parseRootCondition(ContainerInterface $container, ModelRelationshipDefinitionInterface $definition)
 {
     if (($rootCondition = $this->getFromDca('dca_config/rootEntries')) !== null) {
         $rootProvider = $container->getBasicDefinition()->getRootDataProvider();
         if (!$rootProvider) {
             throw new DcGeneralRuntimeException('Root data provider name not specified in DCA but rootEntries section specified.');
         }
         if (!$container->getDataProviderDefinition()->hasInformation($rootProvider)) {
             throw new DcGeneralRuntimeException('Unknown root data provider but rootEntries section specified.');
         }
         if (isset($rootCondition[$rootProvider])) {
             $rootCondition = $rootCondition[$rootProvider];
             $mySetter = $rootCondition['setOn'];
             if (($relationship = $definition->getRootCondition()) === null) {
                 $relationship = new RootCondition();
                 $setter = $mySetter;
                 $builder = FilterBuilder::fromArrayForRoot()->getFilter();
             } else {
                 /** @var RootConditionInterface $relationship */
                 if ($relationship->getSetters()) {
                     $setter = array_merge_recursive($mySetter, $relationship->getSetters());
                 } else {
                     $setter = $mySetter;
                 }
                 $builder = FilterBuilder::fromArrayForRoot($relationship->getFilterArray())->getFilter();
             }
             $builder->append(FilterBuilder::fromArrayForRoot((array) $rootCondition['filter']));
             $relationship->setSourceName($rootProvider)->setFilterArray($builder->getAllAsArray())->setSetters($setter);
             $definition->setRootCondition($relationship);
         }
     }
 }