[TYPO3] Hooks in the extension DB Integration (WFQBE)
Mik B. Shvets
solshark at i-soldi.com
Fri Aug 17 23:20:02 CEST 2007
Hello. This is little example from Mauro Lorenzutti, DB Integration developer:
First of all you have to create an extension and to put the following
line in the ext_localconf.php file:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['wfqbe']['preProcessQueryStructure'][]
=
'EXT:your_ext_key/res/class.tx_wfqbe_preprocessquery.php:tx_wfqbe_preprocessquery';
Then you have to create the class.tx_wfqbe_preprocessquery.php class and
the tx_wfqbe_preprocessquery function as follows:
class tx_wfqbe_preprocessquery {
function tx_wfqbe_preprocessquery() {
}
function process_query_structure($wfqbe, $piVars, $query_uid,
&$callingObj) {
$remove = array();
// Query to be processed
if ($query_uid==65) {
$markers = array(
"USERNAME", "GROUP", "ADDRESS"
);
foreach ($markers as $marcatore) {
if ($piVars[$marcatore]=='' ||
(is_array($piVars[$marcatore]) && $piVars[$marcatore][0]=='')) {
foreach ($wfqbe[0]['insert'] as $key => $value) {
if (strpos($value, 'WFQBE_'.$marcatore)>0) {
$remove[] = $key;
unset($wfqbe[0]['insert'][$key]);
}
}
}
}
}
return $remove;
}
}
This function checks if the three markers are empty, in this case it
removes all the conditions in the where clause of the query with uid 65
that are related to this markers. I think you simply need to change the
uid of the query and the markers names (and of course to repeat this for
all the queries that you want to preprocess).
--
primus inter pares
More information about the TYPO3-english
mailing list