Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Forms/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function create()
$jsDriver = $this->parseJsParamDriverAndOptions($this->params->get('js'), $form);

$data['form_config'] = ($configFields = Form::extraConfigFor($form->handle()))
? Blueprint::makeFromTabs($configFields)->fields()->addValues($form->data()->all())->values()->all()
? Blueprint::makeFromTabs($configFields)->fields()->addValues($form->data()->all())->augment()->values()->all()
: [];

$data['sections'] = $this->getSections($this->sessionHandle(), $jsDriver);
Expand Down
16 changes: 16 additions & 0 deletions tests/Tags/Form/FormCreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1004,4 +1004,20 @@ public function it_adds_appended_config_fields()
$this->assertStringStartsWith('<form method="POST" action="http://localhost/!/forms/contact" class="form" id="form">', $output);
$this->assertStringContainsString('This is a test config value', $output);
}

#[Test]
public function it_augments_appended_config_fields()
{
Form::appendConfigFields('*', 'Fields', [
'test_config' => ['type' => 'bard', 'display' => 'A Bard field'],
]);

tap(Form::find('contact')->data(
['test_config' => [['type' => 'paragraph', 'content' => [['type' => 'text', 'text' => 'Shut up, Malacoustix!']]]]])
)->save();

$output = $this->tag('{{ form:contact redirect="/submitted" error_redirect="/errors" class="form" id="form" }}{{ form_config:test_config }}{{ /form:contact }}');

$this->assertStringContainsString('<p>Shut up, Malacoustix!</p>', $output);
}
}