Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Sulu\Component\Rest\ListBuilder\ListRepresentation;
use Sulu\Component\Rest\ListBuilder\ListRestHelperInterface;
use Sulu\Component\Rest\ListBuilder\Metadata\FieldDescriptorFactoryInterface;
use Sulu\Component\Rest\ListBuilder\PaginatedRepresentation;
use Sulu\Component\Rest\RestHelperInterface;
use Sulu\Component\Security\SecuredControllerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -139,11 +140,9 @@ public function cgetAction(Request $request): Response
}

// create list representation
$representation = new ListRepresentation(
$representation = new PaginatedRepresentation(
$list,
$this->getListName(),
$request->get('_route'),
$request->query->all(),
$page,
$limit,
$total
Expand Down
248 changes: 0 additions & 248 deletions Controller/FormWebsiteController.php

This file was deleted.

5 changes: 2 additions & 3 deletions Controller/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Sulu\Component\Rest\AbstractRestController;
use Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilderFactoryInterface;
use Sulu\Component\Rest\ListBuilder\ListRepresentation;
use Sulu\Component\Rest\ListBuilder\PaginatedRepresentation;
use Sulu\Component\Rest\RestHelperInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -109,11 +110,9 @@ public function cgetAction(Request $request): Response
$limit = $listBuilder->getLimit();

// create list representation
$representation = new ListRepresentation(
$representation = new PaginatedRepresentation(
$list,
'entries',
$request->get('_route'),
$request->query->all(),
$page,
$limit,
$total
Expand Down
2 changes: 0 additions & 2 deletions DependencyInjection/SuluFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ public function load(array $configs, ContainerBuilder $container): void
}

if (SuluKernel::CONTEXT_WEBSITE === $container->getParameter('sulu.context')) {
$container->setAlias(FormWebsiteController::class, 'sulu_form.form_website_controller')
->setPublic(true);
$container->setAlias(FormTokenController::class, 'sulu_form.form_token_controller')
->setPublic(true);
}
Expand Down
19 changes: 12 additions & 7 deletions Metadata/DynamicFormMetadataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Sulu\Bundle\FormBundle\Metadata;

use Sulu\Bundle\AdminBundle\FormMetadata\FormMetadataMapper;
use Sulu\Bundle\AdminBundle\FormMetadata\FormXmlLoader;
use Sulu\Bundle\AdminBundle\Metadata\FormMetadata\Loader\FormXmlLoader;
use Sulu\Bundle\AdminBundle\Metadata\FormMetadata\FieldMetadata;
use Sulu\Bundle\AdminBundle\Metadata\FormMetadata\FormMetadata;
use Sulu\Bundle\AdminBundle\Metadata\FormMetadata\FormMetadataLoaderInterface;
Expand Down Expand Up @@ -45,6 +45,8 @@ class DynamicFormMetadataLoader implements FormMetadataLoaderInterface, CacheWar

/**
* @var FormMetadataMapper
*
* TODO REMOVE
*/
private $formMetadataMapper;

Expand Down Expand Up @@ -90,7 +92,7 @@ public function warmUp($cacheDir, ?string $buildDir = null): array
$formMetadataCollection = $this->formXmlLoader->load($resource);
foreach ($formMetadataCollection->getItems() as $locale => $formMetadata) {
$section = new SectionMetadata('formFields');
$section->setLabel($this->translator->trans('sulu_form.form_fields', [], 'admin', $locale));
$section->setLabel($this->translator->trans('sulu_form.form_fields', [], 'admin', $locale), $locale);
$fields = new FieldMetadata('fields');
$fields->setType('block');

Expand All @@ -101,8 +103,8 @@ public function warmUp($cacheDir, ?string $buildDir = null): array
$fieldTypeMetaDataCollection[] = $this->loadFieldTypeMetadata($typeKey, $type, $locale);
}

\usort($fieldTypeMetaDataCollection, static function(FormMetadata $a, FormMetadata $b): int {
return \strcmp($a->getTitle(), $b->getTitle());
\usort($fieldTypeMetaDataCollection, static function(FormMetadata $a, FormMetadata $b)use($locale): int {
return \strcmp($a->getTitle($locale), $b->getTitle($locale));
});

foreach ($fieldTypeMetaDataCollection as $fieldTypeMetaData) {
Expand All @@ -111,11 +113,13 @@ public function warmUp($cacheDir, ?string $buildDir = null): array

$fields->setDefaultType(\current($fields->getTypes())->getName());
$section->addItem($fields);
/* TODO HOW?
$formItems = $formMetadata->getItems();
$this->arrayInsertAtPosition($formItems, 1, [$section->getName() => $section]);
$formMetadata->setItems($formItems);
$configCache = $this->getConfigCache($formMetadata->getKey(), $locale);
$configCache->write(\serialize($formMetadata), [new FileResource($resource)]);
*/
}

return [];
Expand Down Expand Up @@ -151,11 +155,12 @@ private function loadFieldTypeMetadata(string $typeKey, FormFieldTypeInterface $
{
$form = new FormMetadata();
$configuration = $type->getConfiguration();

$properties = $this->propertiesXmlLoader->load($configuration->getXmlPath());

$form->setItems($this->formMetadataMapper->mapChildren($properties->getProperties(), $locale));
$form->setName($typeKey);
$form->setTitle($this->translator->trans($configuration->getTitle(), [], 'admin', $locale));
$form->setItems($properties);
$form->setKey($typeKey);
$form->setTitle($this->translator->trans($configuration->getTitle(), [], 'admin', $locale), $locale);

return $form;
}
Expand Down
Loading
Loading