-
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.
Merge pull request #43 from VSVverkeerskunde/feature/VSVGVQ-76
VSVGVQ-76 add functionality to edit image of question
- Loading branch information
Showing
10 changed files
with
267 additions
and
11 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
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,47 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace VSV\GVQ_API\Question\Forms; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\FileType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Component\Translation\TranslatorInterface; | ||
use Symfony\Component\Validator\Constraints\NotBlank; | ||
|
||
class ImageFormType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
/** @var TranslatorInterface $translator */ | ||
$translator = $options['translator']; | ||
|
||
$builder | ||
->add( | ||
'image', | ||
FileType::class, | ||
[ | ||
'constraints' => [ | ||
new NotBlank( | ||
[ | ||
'message' => $translator->trans('Empty field'), | ||
] | ||
), | ||
|
||
], | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefaults( | ||
[ | ||
'translator' => null, | ||
] | ||
); | ||
} | ||
} |
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,25 @@ | ||
{% extends 'admin_index_base.html.twig' %} | ||
|
||
{% block title %}{% trans %}Change.picture{% endtrans %}{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }} | ||
|
||
<div class="form-group"> | ||
<label for="question_form_image">{% trans %}Foto{% endtrans %}</label> | ||
{{ form_widget(form.image, {'attr': {'style': 'opacity: 1'}}) }} | ||
{{ form_errors(form.image) }} | ||
</div> | ||
|
||
<div class="form-group"> | ||
<a role="button" | ||
class="btn btn-secondary" | ||
href="{{ path('questions_view_index') }}">{% trans %}Annuleren{% endtrans %} | ||
</a> | ||
<button type="submit" class="btn btn-primary">{% trans %}Bewaar{% endtrans %}</button> | ||
</div> | ||
|
||
{{ form_end(form) }} | ||
|
||
{% 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
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
Oops, something went wrong.