Skip to content

Commit

Permalink
Merge pull request #29 from bolt/feature/button-type
Browse files Browse the repository at this point in the history
Add button type. Fix issue with date field in email
  • Loading branch information
bobdenotter authored Nov 24, 2020
2 parents 29e7b0d + 6858e89 commit c65f7a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Factory/FieldOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static function get(string $formName, array $field): array

$options['constraints'] = FieldConstraints::get($formName, $options);

if ($field['type'] === 'submit') {
if ($field['type'] === 'submit' || $field['type'] === 'button') {
unset($options['constraints']);
}

Expand Down
4 changes: 4 additions & 0 deletions src/Factory/FieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Bolt\BoltForms\Factory;

use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
Expand Down Expand Up @@ -51,6 +52,9 @@ public static function get($field): string
case 'country':
$type = CountryType::class;
break;
case 'button':
$type = ButtonType::class;
break;
case 'text':
default:
$type = TextType::class;
Expand Down
2 changes: 2 additions & 0 deletions templates/email_blocks.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
<li>
{%- if field.type == 'file' %}
{{ block('file_field_value') }}
{%- if field.type in ['date', 'datetime', 'dateinterval']%}
{{ block('field_date') }}
{%- else %}
{{ block('field_value') }}
{%- endif %}
Expand Down

0 comments on commit c65f7a6

Please sign in to comment.