-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Snowbaha/master
fix: documentation + Resources for Sylius 1.9
- Loading branch information
Showing
8 changed files
with
96 additions
and
3 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
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mezcalito\SyliusFileUploadPlugin\Form\Type; | ||
|
||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; | ||
use Symfony\Component\Form\Extension\Core\Type\FileType as SymfonyFileType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
abstract class FileType extends AbstractResourceType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder | ||
->add('type', TextType::class, [ | ||
'label' => 'sylius.form.file.type', | ||
'required' => false, | ||
]) | ||
->add('file', SymfonyFileType::class, [ | ||
'label' => 'sylius.form.file.file', | ||
]) | ||
; | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'sylius_file'; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
sylius: | ||
ui: | ||
preview_file: Preview file | ||
form: | ||
file: | ||
type: Type | ||
file: File |
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,8 @@ | ||
|
||
sylius: | ||
ui: | ||
preview_file: Aperçu fichier | ||
form: | ||
file: | ||
type: Type | ||
file: Fichier |
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,5 @@ | ||
{% extends '@MezcalitoSyliusFileUploadPlugin/Form/theme.html.twig' %} | ||
|
||
{% block sylius_product_file_widget %} | ||
{{ block('sylius_file_widget') }} | ||
{% endblock %} |
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,21 @@ | ||
{% extends '@SyliusUi/Form/theme.html.twig' %} | ||
|
||
{% block sylius_file_widget %} | ||
|
||
{% apply spaceless %} | ||
{% if form.vars.value.path|default(null) is not null %} | ||
<a class="ui icon teal basic button" href="{{ asset('media/file/'~form.vars.value.path) }}" target="_blank"> | ||
<i class="file show icon"></i> {{ 'sylius.ui.preview_file'|trans }} | ||
</a> | ||
{% endif %} | ||
|
||
{{ form_row(form.type) }} | ||
<label for="{{ form.file.vars.id }}" class="ui icon labeled button"><i class="cloud upload icon"></i> {{ 'sylius.ui.choose_file'|trans }}</label> | ||
<div class="ui hidden element"> | ||
{{ form_widget(form.file) }} | ||
</div> | ||
<div class="ui element"> | ||
{{- form_errors(form.file) -}} | ||
</div> | ||
{% endapply %} | ||
{% endblock %} |