Skip to content
Snippets Groups Projects
Unverified Commit 15abc316 authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Import add delete button and improve validation on customCode

parent f2c0bb13
No related branches found
No related tags found
No related merge requests found
...@@ -152,8 +152,8 @@ class Import extends AbstractFile ...@@ -152,8 +152,8 @@ class Import extends AbstractFile
*/ */
public function validate(ExecutionContextInterface $context) public function validate(ExecutionContextInterface $context)
{ {
if (preg_match("/new |process|mongo/i", $this->customCode)) { if (preg_match("/new |process|mongo|this|symfony/i", $this->customCode)) {
$context->buildViolation("Il est interdit d'utiliser les mots suivants: new, mongo, process... Merci de ne pas faire de betises !") $context->buildViolation("Il est interdit d'utiliser les mots suivants: new, mongo, process, this, symfony... Merci de ne pas faire de betises !")
->atPath('customCode') ->atPath('customCode')
->addViolation(); ->addViolation();
} }
......
...@@ -22,5 +22,10 @@ ...@@ -22,5 +22,10 @@
<a href="{{ admin.generateObjectUrl('list', object) }}" class="btn btn-default view_link"> <a href="{{ admin.generateObjectUrl('list', object) }}" class="btn btn-default view_link">
<i class="fa fa-list" aria-hidden="true"></i>Retour à la liste <i class="fa fa-list" aria-hidden="true"></i>Retour à la liste
</a> </a>
{% if object.id != "" %}
<a href="{{ admin.generateObjectUrl('delete', object) }}" class="btn btn-danger view_link">
<i class="fa fa-trash" aria-hidden="true"></i>Supprimer (ainsi que tous les éléments importés)
</a>
{% endif %}
{% endblock %} {% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment