I want to make my own finisher but I don't have a clue what is needed.
I have \Domain\Finishers\MyOwnFinisher.php // with the finisher class Configuration\Form\Backend.yaml //which should tell my TYPO3 where to look for the finisher Configuration\TypoScript\setup.typoscript //telling EXT:form where the Backend.yaml is
but still I get an exception: "The finisher preset identified by “xxx” could not be found, or the implementationClassName was not specified."
Is there some file I forgot? Some configuration I must set?
Backend.yaml
prototypes:
standard:
finishersDefinition:
MyOwn:
implementationClassName: 'mastar\testprivateext\Classes\Domain\Finishers\MyOwnFinisher'
options:
table: tx_testprivateext_domain_model_YetAnotherTable
setup.typoscript
@import "EXT:testprivateext/Configuration/TypoScript/Setup/*.typoscript"
plugin.tx_form.settings.yamlConfigurations {
901 = EXT:testprivateext/Configuration/Form/Backend.yaml
}
MyOwnFinisher.php
<?php
declare(strict_types=1);
namespace mastar\testprivateext\Classes\Domain\Finishers;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Form\Domain\Finishers\Exception\FinisherException;
use TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface;
use TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher;
class MyOwnFinisher extends AbstractFinisher {
protected $defaultOptions = [
'table' => 'tx_testprivateext_domain_model_YetAnotherTable',
'pid' => '34',
'name' => '',
'unterzeile' => '',
'strasse' => '',
'hausnummer' => '',
'plz' => '',
'ort' => '',
'telefon' => '',
'fax' => '',
'web' => '',
];
protected $shortFinisherIdentifier = 'MyOwn';
protected $databaseConnection;
protected function executeInternal() {
/// Stuff get's done here
}
}
Thanks in advance!
You have some definition in the yaml file, I complete it as I never know if you missed it or left it out:
TYPO3:
CMS:
Form:
prototypes:
standard:
finishersDefinition:
MyOwn:
implementationClassName: 'mastar\testprivateext\Classes\Domain\Finishers\MyOwnFinisher'
options:
table: tx_testprivateext_domain_model_YetAnotherTable
Beside that I never see an obvious fault and guess that you know the documentation how to write an own finisher.
One issue when new classes are added can sometimes be solved by clearing the cache and dumping autoload.
Furthermore it might be helpful to check the logfile, not all problems are reported by the log inside the TYPO3 backend.
EDIT:
I just see this is wrong:
implementationClassName:
'mastar\testprivateext\Classes\Domain\Finishers\MyOwnFinisher'
and should be instead:
implementationClassName:
'mastar\testprivateext\Domain\Finishers\MyOwnFinisher'
So actually you've to separate paths and namespace, they are similar but not the same. Important might be the vendor and extensionName in the namespace too, I'd advise to read the extbase tutorial if you never understand namespaces well.