[TYPO3-dev] Howto extend 3rd partxy Extension?
Jigal van Hemert
jigal.van.hemert at typo3.org
Mon Mar 2 11:21:58 CET 2015
Hi,
On 02/03/2015 00:01, Dirk Ho wrote:
> before I start coding, I wanted to ask, how best practice is to extend a
> 3rd party extension - in my case it's Powermail2.
In TYPO3 is a mechanism called XCLASS [1] which allows you to extend an
existing class (and effectively replace one or more of its functions).
The extended class is automatically used instead of the existing class.
As explained in the documentation the safest option is if you can call
the original method (call parent::functionName(); ) at some point in
your extended version of the function. That way the original is used
also after updating the extension.
> Because I use powermail2 not only for a membership form, but also for a
> contact form, I need the possibility to set a flag, whether to use the
> new functionality or not.
You can always use an extra option somewhere in the 'settings' section
of the powermail TypoScript configuration and check your new setting in
your own code. Your XCLASS-code runs in the context of the original
powermail code, so you can easily access the powermail settings.
[1]
http://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Xclasses/Index.html
--
Jigal van Hemert
TYPO3 CMS Active Contributor
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-dev
mailing list