Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC][Admin] Separate base form types #16238

Closed
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Form\Extension;
namespace Sylius\Bundle\AdminBundle\Form\Type;

use Sylius\Bundle\AdminBundle\Form\Type\ProductAssociationsType;
use Sylius\Bundle\CoreBundle\Form\Type\Product\ProductImageType;
use Sylius\Bundle\ProductBundle\Form\Type\ProductType;
use Symfony\Component\Form\AbstractTypeExtension;
use Sylius\Bundle\ProductBundle\Form\Type\ProductType as BaseProductType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\UX\LiveComponent\Form\Type\LiveCollectionType;

final class ProductTypeExtension extends AbstractTypeExtension
final class ProductType extends AbstractType
{
/**
* @param array<string, mixed> $options
Expand All @@ -43,11 +42,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
;
}

/**
* @return iterable<class-string>
*/
public static function getExtendedTypes(): iterable
public function getParent(): string
{
return [ProductType::class];
return BaseProductType::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ sylius_admin_product:
templates: "@SyliusAdmin\\shared\\crud"
redirect: update
grid: sylius_admin_product
form:
type: Sylius\Bundle\AdminBundle\Form\Type\ProductType
permission: true
vars:
all:
Expand Down Expand Up @@ -39,6 +41,8 @@ sylius_admin_product_create_simple:
permission: true
factory:
method: createWithVariant
form:
type: Sylius\Bundle\AdminBundle\Form\Type\ProductType
template: "@SyliusAdmin/shared/crud/create.html.twig"
redirect: sylius_admin_product_update
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sylius_admin.form.extension.product" class="Sylius\Bundle\AdminBundle\Form\Extension\ProductTypeExtension">
<tag name="form.type_extension" />
<service id="sylius_admin.form.type.product" class="Sylius\Bundle\AdminBundle\Form\Type\ProductType">
<tag name="form.type" />
</service>

<service id="sylius_admin.form.type.product_associations" class="Sylius\Bundle\AdminBundle\Form\Type\ProductAssociationsType">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
class="Sylius\Bundle\AdminBundle\Twig\Component\Product\FormComponent"
>
<argument type="service" id="form.factory" />
<argument>Sylius\Bundle\ProductBundle\Form\Type\ProductType</argument>
<argument>Sylius\Bundle\AdminBundle\Form\Type\ProductType</argument>
<argument type="service" id="sylius.generator.slug" />
<argument type="service" id="sylius.repository.product_attribute" />
<argument type="service" id="sylius.factory.product" />
Expand Down