Skip to content

Commit 79f5895

Browse files
authored
Allow callable for block config options
Allow options for block config to be AJAX-derived options.
1 parent 06f479c commit 79f5895

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

formwidgets/Blocks.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,14 @@ protected function processInspectorConfig(array $config): array
337337
'span',
338338
]));
339339

340-
if (isset($defined['options']) && is_array($defined['options'])) {
341-
foreach ($defined['options'] as $key => &$value) {
342-
$value = Lang::get($value);
340+
if (isset($defined['options'])) {
341+
if (is_array($defined['options'])) {
342+
foreach ($defined['options'] as $key => &$value) {
343+
$value = Lang::get($value);
344+
}
345+
} elseif (is_callable($defined['options'])) {
346+
$callable = $defined['options'];
347+
$defined['options'] = $callable($this->formWidget, $this->formField);
343348
}
344349
}
345350

0 commit comments

Comments
 (0)