add boolean field for CRUD

This commit is contained in:
Simon Vieille 2023-07-19 20:19:16 +02:00
parent e2c9ecb941
commit f144760085
Signed by: deblan
GPG key ID: 579388D585F70417
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<?php
namespace App\Core\Crud\Field;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* class BooleanField.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class BooleanField extends Field
{
public function configureOptions(OptionsResolver $resolver): OptionsResolver
{
parent::configureOptions($resolver);
$resolver->setDefaults([
'view' => '@Core/admin/crud/field/boolean.html.twig',
]);
return $resolver;
}
}

View file

@ -0,0 +1,11 @@
{%- block value -%}
{% if value %}
<span class="rounded-pill pl-3 pr-1 bg-secondary text-white">
<span class="fa fa-circle"></span>
</span>
{% else %}
<span class="rounded-pill pr-3 pl-1 bg-secondary text-white">
<span class="fa fa-circle"></span>
</span>
{% endif %}
{%- endblock -%}