Dear All,
Recently I started working with contao as CMS and this would be the first time I used a hook. But somehow I don't seem to get it working. It looks like the hook is never triggerd by the event. I assume I missed something.
Ok, lets give you what i have got so far:
vacaturebank/config/config.php
Code:
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
//Back-end
array_insert($GLOBALS['BE_MOD']['content'], 3, array(
'vacaturebank' => array(
'tables' => array('tl_vacaturebank'),
'icon' => 'system/modules/vacaturebank/html/icon.png'
)
));
//Front-end
array_insert($GLOBALS['FE_MOD']['vacaturebank'], 0, array(
'vacaturebank' => 'ModuleVacaturebank',
'vacaturebank detail' => 'ModuleVacaturebankDetail',
'vacaturebank soliciteren' => 'ModuleVacaturebankSoliciteren',
'vacaturebank overzicht FE' => 'ModuleVacaturebankOverzicht',
'vacaturebank nieuwe vacature FE' => 'ModuleVacaturebankNieuweVacature',
'vacaturebank bewerk vacature FE' => 'ModuleVacaturebankBewerkVacature'
));
//CSS
$GLOBALS['TL_CSS'][] = 'system/modules/vacaturebank/html/vacaturebank.css';
//hook
$GLOBALS['TL_HOOKS']['processFormData'][] = array('Vacaturebank_lib', 'SendMail');
//Javascript
//$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/vacaturebank/html/vacaturebank.js';
?>
vacaturebank/Vacaturebank_lib.php
Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
class Vacaturebank_lib extends System
{
public function SendMail($arrPost, $arrForm, $arrFiles, $arrLabels)
{
$email = new Email();
$email->subject = 'JOEPIE';
$email->html = 'poepje';
$email->sendTo('f.c.martin@student.tue.nl');
}
}?>
Also a template file, in which the form is that i need to process is:
vacaturebank/templates/mod_vacaturebank_soliciteren.html
Code:
<form name="soliciteren" action="solliciteren.html?id=<?php echo $this->vid; ?>" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token::*}}">
<input type="hidden" name="MAX_FILE_SIZE" value="2048000">
<input type="hidden" id="send" name="send" value="1" />
<input type="hidden" id="id" name="id" value="<?php echo $this->vid; ?>" />
<input type="submit" class="button" value="Verstuur sollicitatie" />
</form>
I have considered to use the default form generator, but unfortunately i cannot achief the desired result with the formgenerator. (As i need to send the form to a email from the database including an attachment) Also a bunch of other files are included in this module but i dont think these are relevant.
I would appriciate it much if someone would look at this.
Kind regards,
Frank
Bookmarks