mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Moving ChannelTypeExtension to the Shop Bundle
This commit is contained in:
parent
3a79005d80
commit
f8390b9b11
4 changed files with 36 additions and 16 deletions
|
|
@ -24,7 +24,6 @@ use Sylius\Bundle\CoreBundle\Form\Type\TaxCalculationStrategyChoiceType;
|
|||
use Sylius\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType;
|
||||
use Sylius\Bundle\LocaleBundle\Form\Type\LocaleChoiceType;
|
||||
use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonAutocompleteChoiceType;
|
||||
use Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType;
|
||||
use Sylius\Component\Core\Model\Scope;
|
||||
use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
|
|
@ -68,18 +67,7 @@ final class ChannelTypeExtension extends AbstractTypeExtension
|
|||
])
|
||||
->add('taxCalculationStrategy', TaxCalculationStrategyChoiceType::class, [
|
||||
'label' => 'sylius.form.channel.tax_calculation_strategy',
|
||||
]);
|
||||
|
||||
if (class_exists('\Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType')) {
|
||||
$builder->add('themeName', ThemeNameChoiceType::class, [
|
||||
'label' => 'sylius.form.channel.theme',
|
||||
'required' => false,
|
||||
'empty_data' => null,
|
||||
'placeholder' => 'sylius.ui.no_theme',
|
||||
]);
|
||||
}
|
||||
|
||||
$builder
|
||||
])
|
||||
->add('contactEmail', EmailType::class, [
|
||||
'label' => 'sylius.form.channel.contact_email',
|
||||
'required' => false,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\ShopBundle\Form\Extension;
|
||||
|
||||
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelType;
|
||||
use Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType;
|
||||
use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final class ChannelTypeExtension extends AbstractTypeExtension
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
if (class_exists('\Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType')) {
|
||||
$builder->add('themeName', ThemeNameChoiceType::class, [
|
||||
'label' => 'sylius.form.channel.theme',
|
||||
'required' => false,
|
||||
'empty_data' => null,
|
||||
'placeholder' => 'sylius.ui.no_theme',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [ChannelType::class];
|
||||
}
|
||||
}
|
||||
|
|
@ -13,9 +13,7 @@
|
|||
|
||||
<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>
|
||||
<defaults public="true" />
|
||||
|
||||
<service id="sylius.theme.context.channel_based" class="Sylius\Bundle\ShopBundle\Theme\ChannelBasedThemeContext" public="false">
|
||||
<service id="sylius.theme.context.channel_based" class="Sylius\Bundle\ShopBundle\Theme\ChannelBasedThemeContext">
|
||||
<argument type="service" id="sylius.context.channel" />
|
||||
<argument type="service" id="sylius.repository.theme" />
|
||||
</service>
|
||||
|
|
|
|||
|
|
@ -62,5 +62,9 @@
|
|||
<service id="sylius_shop.form.type.product_review" class="Sylius\Bundle\ShopBundle\Form\Type\Product\ProductReviewType">
|
||||
<tag name="form.type" />
|
||||
</service>
|
||||
|
||||
<service id="Sylius\Bundle\ShopBundle\Form\Extension\ChannelTypeExtension">
|
||||
<tag name="form.type_extension" priority="100" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue