Skip to content

Commit 408767d

Browse files
[5.x] Allow config values to be used in forms (#11403)
Co-authored-by: Jason Varga <jason@pixelfear.com>
1 parent ed45f9f commit 408767d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Forms/Form.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Statamic\Events\FormDeleting;
1818
use Statamic\Events\FormSaved;
1919
use Statamic\Events\FormSaving;
20+
use Statamic\Facades\Antlers;
2021
use Statamic\Facades\Blueprint;
2122
use Statamic\Facades\File;
2223
use Statamic\Facades\Form as FormFacade;
@@ -268,6 +269,12 @@ public function delete()
268269
public function hydrate()
269270
{
270271
$contents = YAML::parse(File::get($this->path()));
272+
$variables = ['config' => config()->all()];
273+
array_walk_recursive($contents, function (&$value) use ($variables) {
274+
if (is_string($value)) {
275+
$value = (string) Antlers::parse($value, $variables);
276+
}
277+
});
271278

272279
$methods = [
273280
'title',

0 commit comments

Comments
 (0)