# Add Finisher Classes ## Introduction Let's say you want easily add some own php functions that should be called after a user submits a form or if you want to override original Finishers from powermail, a Finisher is the best choice. Maybe you want to handle the user input to: * Send it to an API * Store it in a logfile * Save it into a table * Something else... ## Small example Just define which classes should be used. Every method like \*Finisher() will be called - e.g. myFinisher(): ``` plugin.tx_powermail.settings.setup { finishers { 1 { class = Vendor\Ext\Finisher\DoSomethingFinisher } } } ``` Add a php-file `DoSomethingFinisher.php` and extend your class with the AbstractFinisher from powermail: ``` configuration['foo']; // get subject from mail $subject = $this->getMail()->getSubject(); // get a value by markername $value = $this->getMail()->getAnswersByFieldMarker()['markerName']->getValue(); // get a value by field uid $value = $this->getMail()->getAnswersByFieldUid()[123]->getValue(); // do some more magic ... } } ``` ## Some notices * All methods which are ending with "finisher" will be called - e.g. `saveFinisher()`. * The method `initializeFinisher()` will always be called at first. * Every finisher method could have its own initialize method, which will be called before. Like `initializeMyFinisher()` before `myFinisher()`. * Classes in extensions (if namespace and filename fits) will be automatically included from TYPO3 autoloader. If you place a single file in fileadmin, use "require" in TypoScript. * Per default 10, 20 and 100 is already in use from powermail itself (SaveToAnyTableFinisher, SendParametersFinisher, RedirectFinisher).