Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.12. Developers corner

Database relation model

(also available in extension folder powermail/doc/database_relation)

tt_content: Original tt_content field extended with some powermail fields

tx_powermail_fieldsets: Table with all fieldsets

tx_powermail_fields: Table with all fields

tx_powermail_mails: If you submit in a form the values are saved to this table

Hooks in powermail

Introduction

With the possibilitiy of hooks, you can manipulate extensions and TYPO3 without changing the code. So you enter your own code from outside.

Hook documentation

#

Hookname

File

Folder

Function

Input

Return

Note

Example use

1

Hook for page with form

class.tx_powermail_form.php

pi1

PM_FormWrapMarkerHook

$this->OuterMarkerArray, $this->subpartArray, $this->conf, $this

-

This hook will be opened before the marker array is substituted with HTML template on the form page. Maybe if you want to add some hiddenfields in the end of the form, you can use this marker

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHook'][]

2

Hook for html fieldwrap of every single field

class.tx_powermail_html.php

pi1

PM_FieldWrapMarkerHook

$this->uid,$this->xml, $this->type, $this->title, $this->markerArray, $content, $this

$this->markerArray

This hook will be opened before the html code of the current field is given back. Maybe if you want to manipulate a special field

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldWrapMarkerHook'][]

3

Hook for confirmation page

class.tx_powermail_confirmation.php

pi1

PM_ConfirmationHook

$this->markerArray, $this

-

This hook will be opened before the marker array is substituted with HTML template on the confirmation page.

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_ConfirmationHook'][]

4

Mandatory and error check hook

class.tx_powermail_mandatory.php

pi1

PM_MandatoryHook

$this->error, $this->markerArray, $this->innerMarkerArray, $this->sessionfields, $this

-

If you set $this->error to 1, powermail will stop the submit process, with $this->sessionfields you can write your own error message

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_MandatoryHook'][]

5

Hook for email change

class.tx_powermail_submit.php

pi1

PM_SubmitEmailHook

$this->subpart, $this->maildata, $this->sessiondata, $this->markerArray, $this

-

This hook allows to change the emails (subject, receiver, sender, etc..)

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitEmailHook'][]

6

Submit hook before submit

class.tx_powermail_submit.php

pi1

PM_SubmitBeforeMarkerHook

$this, $this->markerArray, $this->sessiondata

Errorcode (0/1 bolean)

If you want to stop the submit (emails and db insert), you can return TRUE

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitBeforeMarkerHook'][]

7

Submit hook after emails

class.tx_powermail_submit.php

pi1

PM_SubmitAfterMarkerHook

$this, $this->markerArray, $this->sessiondata

-

If you want to do something after a correct submit, you can use this hook (maybe an additional db entry)

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitAfterMarkerHook'][]

How to use a hook in my own extension?

Example for using a powermail hook in your own extension in the ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHook'][] = 'EXT:yourextension/targetphpfile:tx_yourphpclass';

This hook want to use the function PM_FormWrapMarkerHook() in your class

Note: The class name must start with a tx_

Additional information

Hook documentation is also available in extension folder powermail\doc\hook

  1. hooks.ods could be open with OpenOffice

  2. hooks.html can be read with a browser

Look into another extension which uses a powermail hook to manipulate powermail

The antispam extension wt_spamshield uses two powermail hooks, look into the code, if you want to know more:

http://typo3.org/extensions/repository/view/wt_spamshield/0.1.6/

Do you need a new hook?

Do you need a special hook? Write us!