Skip to content

Commit

Permalink
Merge pull request #17 from smg6511/fix-prehook-inclusion
Browse files Browse the repository at this point in the history
Fix adding prehooks in manager component
  • Loading branch information
ilyautkin authored Dec 1, 2021
2 parents 6e3d16e + 83a7623 commit 0430c7c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ public function run(array $properties = [])
$currentStepIndex++;
}

$formPrehooks = explode(',', trim($form->get('prehooks')));
$formPrehooks = !empty($formPrehooks) ? array_map('trim', $formPrehooks) : $formPrehooks ;

$scriptPrehooks = explode(',', trim($this->getProperty('preHooks')));
$scriptPrehooks = !empty($scriptPrehooks) ? array_map('trim', $scriptPrehooks) : $scriptPrehooks ;

$prehooks = array_filter(array_merge($formPrehooks, $scriptPrehooks));

if ($form->get('posthooks')) {
$hooks = array_merge(
array_filter(explode(',', $this->getProperty('hooks'))),
Expand Down Expand Up @@ -208,7 +216,7 @@ public function run(array $properties = [])
}

$parameters['hooks'] = $this->parseHooks($hooks);
$parameters['preHooks'] = $this->parseHooks($this->getProperty('preHooks'));
$parameters['preHooks'] = $this->parseHooks($prehooks);
$parameters['renderHooks'] = $this->parseHooks($this->getProperty('renderHooks'));
$parameters['validate'] = $this->parseValidation($validation);

Expand Down

0 comments on commit 0430c7c

Please sign in to comment.