Skip to content

Commit

Permalink
FIX: render form fields have switch condition for theme (mautic#13779)
Browse files Browse the repository at this point in the history
* Reverse condition

If conditional form is rendered, theme modified templates did not used. It seems because condition here is in opposite

* Correct loading of a theme with template having precedence

---------

Co-authored-by: John Linhart <[email protected]>
Co-authored-by: John Linhart <[email protected]>
  • Loading branch information
3 people authored Jun 6, 2024
1 parent 5bf1b10 commit e8d5b6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
18 changes: 1 addition & 17 deletions app/bundles/FormBundle/Resources/views/Builder/form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,8 @@
{%- set template = '@MauticForm/Field/' ~ f.type ~ '.html.twig' -%}
{%- endif -%}


<!-- start: "{{ theme }}{{ template }}" -->
{%- if theme is empty -%}
{{- include(theme ~ f.type ~ '.html.twig', {
'field': f.convertToArray,
'id': f.alias,
'formName': formName,
'fieldPage': (pageCount - 1),
'mappedFields': mappedFields,
'inBuilder': inBuilder,
'fields': fields,
'language': form.getLanguage()

}) -}}
{%- else -%}
{{- include(template, {
{{- include([theme ~ f.type ~ '.html.twig', template], {
'field': f.convertToArray,
'id': f.alias,
'formName': formName,
Expand All @@ -124,9 +110,7 @@
'inBuilder': inBuilder,
'fields': fields,
'language': form.getLanguage()

}) -}}
{%- endif -%}
<!-- end: "{{ theme }}{{ template }}" -->
{%- endif -%}
{%- endfor -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ public function testSingleFormWorkflow(): void
$this->client->request(Request::METHOD_POST, '/api/forms/new', $payload);
$clientResponse = $this->client->getResponse();
$response = json_decode($clientResponse->getContent(), true);
$formId = $response['form']['id'];

Assert::assertTrue(isset($response['form']['id']), $clientResponse->getContent());

$formId = $response['form']['id'];

$this->assertSame(Response::HTTP_CREATED, $clientResponse->getStatusCode(), $clientResponse->getContent());
$this->assertGreaterThan(0, $formId);
Expand Down

0 comments on commit e8d5b6c

Please sign in to comment.