- To add on any type of Frontend-Plugin
Frontend-Plugins can be added with the command "addPlugin" in the extension "t3lib_extMgm".
Furthermore, TYPO3 offers numerous other functions for Frontend-Plugins, such as content rendering with tslib_content.php.
- To add on any type of Backend-Module
Using the command "addModule", these can be added in the "t3lib_extMgm" extension module. The appropriate code looks like this:
<?php
t3lib_extMgm::addModule('tools', 'txaoeanalyseM1', '',
t3lib_extMgm::extPath($_EXTKEY) . 'mod1/');
?>
- To add on Database tables and fields in existing chart
TYPO3 possesses a powerful concept for database configuration: TCA (TYPO3 Configuration Array), whereby, among other things, the behavior of input fields can be configured in the backend. By using the data-in ext_tables.sql, ext_tables.php and tca.php, these can be flexibly adapted to the TYPO3 structure as well as to its TCA configuration.
- Database abstraction
The MySQL database can be addressed by using the PHP class t3lib_DB, the Database Abstraction Base API. This class already contains ready-capped MySQL instructions, which can then be adapted. But it's not only MySQL database which can be addressed in this way, but also proprietary database such as Oracle.
- Extend database tables with static information
To do this, the following file must be created in the extension directory: "ext_tables_static+adt.sql". The "CREATE TABLE" and "INSERT" commands will then be given in this file.
- To add on TypoScript static template files or "adhoc snippets"
To add on register them in the "t3lib_extMgm::addStaticFile()" method path under which the "setup.txt" and "constants.txt" are to be found.
An example for registering the path:
<?php
t3lib_extMgm::addStaticFile($_EXTKEY,
'configuration/typoscript/default/',
'Default configuration of Extension XY');
?>
To introduce "adhoc snippets" use the following method:
File the following in the extension root:
ext_typoscript_setup.txt und ext_typoscript_constants.txt.
These will then automatically be loaded into the system.
The difference between the two integration variants is that, when laying down a path in the databank table, the configuration is only loaded at the place where it was knowingly embedded, whereas using the adhoc method, the configuration is always available throughout the entire TYPO3 installation.
- Adding on Backend skins
Introduce the appropriate PHP command into the databank (System) extension "ext_tables.php":
for example, to define a new Logo in Backend-Skin, introduce the following code:
<?php
$TBE_STYLES['logo'] = t3lib_extMgm::extRelPath($_EXTKEY)
. 'img/aoe_backend_logo.gif';
?>
To add new style instructions in the Backend, use this command:
<?php
$TBE_STYLES['inDocStyles_TBEstyle'] .= "\n" . $styles;
?>
- When adding click-menu items via the "ext_tables.php" (for use with context sensitive menus)
<?php
$GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']
['extendCMclasses'][] = array (
'name' => 'tx_aoepublish_cm1',
'path' => t3lib_extMgm::extPath($_EXTKEY) . `
'class.tx_aoepublish_cm1.php'
);
?>
- Add page and user-configuration with TSconfig
Using the TypoScript wizard you can easily adjust the configuration of the TYPO3 core. With the TSconfig commands, Backend module page characteristics, as well as access rights for groups or individual users can be defined.
For example, with the help of the "addPageTSConfig" command, one can use the localconf.php of the extension manager ( t3lib_extMgm) to easily change the page number in the Backend module. And via the Tools>User/Administrator module, individual user configurations in the "TSConfig" area can be examined and edited.
An example of this would be:
<?php
t3lib_extMgm::addUserTSConfig ('
options.saveDocNew {
tx_aoetirepresenter_property = 1
}
');
?>
- Extending every system class with XCLASS(es)
When developing extensions or changing TYPO3 Core settings TYPO3 offers a very convenient method to manipulate or add to existing PHP classes. If one were to make those changes directly in the Core, they would be lost with any update of the system core. To avoid this risk a PHP command "class...extends" was created. In TYPO3 extended classes are called "XCLASS(es).
One example for providing an XCLASS vor an existing extensions class would look as follows:
<?php
if (defined('TYPO3_MODE') &&
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']
['ext/aoe_tirepresenter/controller/class
.tx_aoetirepresenter_controller_tireFinder.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]
['XCLASS']['ext/aoe_tirepresenter/controller
/class.tx_aoetirepresenter_
controller_tireFinder.php']);
}
?>
Registering a class that extends an existing one, by using XCLASS in the "ext_localconf.php" extension, can be done as follows:
<?php
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea
mod3/class.tx_rtehtmlarea_browse_links.php']
= t3lib_extMgm::extPath($_EXTKEY) .
'patch/4.1/
class.ux_tx_rtehtmlarea_browse_links.php';
?>
- Extending classes in the system with hooks
Since every class can only be extended once by using XCLASS(es), this program technique should only be used in local projects. For extensions that are intended for publication, or for Core alterations that involve many extensions, the "Hook Technique" is preferable.
Hooks extend functions in the Core or extensions, carrying out whichever user-functions are required at defined points in the source code.
First you will need an overview of all the available hook editing points, for which one should use the following extension:
http://typo3.org/extensions/repository/view/dmc_hooklist/current/
A hook is made available with the following code:
<?php
// First prepare user defined objects (if any)
// for hooks which extend this function:
$hookObjectsArr = array();
if (is_array ($TYPO3_CONF_VARS
['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']
['processDatamapClass'])) {
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']
['t3lib/class.t3lib_tcemain.php']
['processDatamapClass']
as $classRef) {
$hookObjectsArr[] = &t3lib_div::getUserObj
($classRef);
}
}
?>
The hook, once installed, needs to be introduced to the TYPO Core. This is done in the "ext_localconf.php" with the following command:
<?php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']
['t3lib/class.t3lib_tcemain.php']
'processDatamapClass']['exportchecker']
= 'EXT:aoe_exportchecker/controller
class.tx_aoeexportchecker_
exportCheckerHookController.php:
tx_aoeexportchecker_exportCheckerHookController';
?>
These examples show that TYPO3 offers the PHP developer a variety of possibilities for modifying the T3 Core to suit particular requirements or to optimize extensions.