Skip to content

Commit

Permalink
[BUGFIX] Use real finisher identifier in form element variants
Browse files Browse the repository at this point in the history
Use the real finisher identifiers as they are configured in the
form definition instead the finisher implementation class name.
This requires a change of the public AbstractFinisher implementation
which implements the FinisherInterface. The interface is not changed,
as this would be a breaking change. Therefore, the existence of the
new method is checked. If it does not exist in a finisher
implementation, a fallback to the previous behavior happens.

Releases: master, 9.5
Resolves: #87615
Change-Id: I962502f0601845a5f9793751e87c97b3b902caa1
Reviewed-on: https://review.typo3.org/59610
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
  • Loading branch information
waldhacker1 authored and maddy2101 committed Feb 1, 2019
1 parent b689a8d commit 8868fae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -94,6 +94,14 @@ public function __construct(string $finisherIdentifier = '')
$this->shortFinisherIdentifier = preg_replace('/Finisher$/', '', $this->finisherIdentifier);
}

/**
* @return string
*/
public function getFinisherIdentifier(): string
{
return $this->finisherIdentifier;
}

/**
* @param array $options configuration options in the format ['option1' => 'value1', 'option2' => 'value2', ...]
*/
Expand Down
8 changes: 6 additions & 2 deletions typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php
Expand Up @@ -1046,8 +1046,12 @@ protected function getConditionResolver(): Resolver

$finisherIdentifier = '';
if ($this->getCurrentFinisher() !== null) {
$finisherIdentifier = (new \ReflectionClass($this->getCurrentFinisher()))->getShortName();
$finisherIdentifier = preg_replace('/Finisher$/', '', $finisherIdentifier);
if (method_exists($this->getCurrentFinisher(), 'getFinisherIdentifier')) {
$finisherIdentifier = $this->getCurrentFinisher()->getFinisherIdentifier();
} else {
$finisherIdentifier = (new \ReflectionClass($this->getCurrentFinisher()))->getShortName();
$finisherIdentifier = preg_replace('/Finisher$/', '', $finisherIdentifier);
}
}

return GeneralUtility::makeInstance(
Expand Down

0 comments on commit 8868fae

Please sign in to comment.