Skip to content

Commit

Permalink
Allow callable for block config options
Browse files Browse the repository at this point in the history
Allow options for block config to be AJAX-derived options.
  • Loading branch information
damsfx committed Feb 15, 2024
1 parent 06f479c commit 79f5895
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions formwidgets/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,14 @@ protected function processInspectorConfig(array $config): array
'span',
]));

if (isset($defined['options']) && is_array($defined['options'])) {
foreach ($defined['options'] as $key => &$value) {
$value = Lang::get($value);
if (isset($defined['options'])) {
if (is_array($defined['options'])) {
foreach ($defined['options'] as $key => &$value) {
$value = Lang::get($value);
}
} elseif (is_callable($defined['options'])) {
$callable = $defined['options'];
$defined['options'] = $callable($this->formWidget, $this->formField);
}
}

Expand Down

0 comments on commit 79f5895

Please sign in to comment.