forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Admin][Taxon] Implements media management
- Loading branch information
Showing
24 changed files
with
263 additions
and
571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Bundle\AdminBundle\Form\Type; | ||
|
||
use Sylius\Bundle\CoreBundle\Form\Type\Taxon\TaxonImageType; | ||
use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonType as BaseTaxonType; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\UX\LiveComponent\Form\Type\LiveCollectionType; | ||
|
||
final class TaxonType extends AbstractType | ||
{ | ||
/** @param array<string, mixed> $options */ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder | ||
->add('images', LiveCollectionType::class, [ | ||
'entry_type' => TaxonImageType::class, | ||
'allow_add' => true, | ||
'allow_delete' => true, | ||
'by_reference' => false, | ||
'button_add_options' => [ | ||
'label' => 'sylius.ui.add_image', | ||
], | ||
'button_delete_options' => [ | ||
'label' => 'sylius.ui.delete', | ||
], | ||
]) | ||
; | ||
} | ||
|
||
public function getParent(): string | ||
{ | ||
return BaseTaxonType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Sylius/Bundle/AdminBundle/Twig/Component/Taxon/FormComponent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Bundle\AdminBundle\Twig\Component\Taxon; | ||
|
||
use Sylius\Component\Core\Model\Taxon; | ||
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait; | ||
use Symfony\Component\Form\FormFactoryInterface; | ||
use Symfony\Component\Form\FormInterface; | ||
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent; | ||
use Symfony\UX\LiveComponent\Attribute\LiveProp; | ||
use Symfony\UX\LiveComponent\DefaultActionTrait; | ||
use Symfony\UX\LiveComponent\LiveCollectionTrait; | ||
|
||
#[AsLiveComponent(name: 'sylius_admin:taxon:form', template: '@SyliusAdmin/taxon/sections/form.html.twig')] | ||
class FormComponent | ||
{ | ||
use DefaultActionTrait; | ||
use HookableLiveComponentTrait; | ||
use LiveCollectionTrait; | ||
|
||
#[LiveProp(fieldName: 'resource')] | ||
public ?Taxon $resource = null; | ||
|
||
/** @param class-string $formClass */ | ||
public function __construct( | ||
private readonly FormFactoryInterface $formFactory, | ||
private readonly string $formClass, | ||
) { | ||
} | ||
|
||
protected function instantiateForm(): FormInterface | ||
{ | ||
return $this->formFactory->create($this->formClass, $this->resource); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
src/Sylius/Bundle/AdminBundle/templates/taxon/component/taxon_tree.html.twig
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/Sylius/Bundle/AdminBundle/templates/taxon/create/form.html.twig
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/Sylius/Bundle/AdminBundle/templates/taxon/form/sections.html.twig
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/Sylius/Bundle/AdminBundle/templates/taxon/form/sections/details/code.html.twig
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/Sylius/Bundle/AdminBundle/templates/taxon/form/sections/media.html.twig
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.