typo3 6.2 for extension developer
DESCRIPTION
Slides of T3DD14 workshop "TYPO3 6.2 for extension developer"TRANSCRIPT
TYPO3 6.2 for extension developer
» Checklist
» Do‘s
» Don‘ts
CPS-IT Mehr Wert im Netz 1
About me Known as @IchHabRecht
Nicole Cordes from Berlin
Programmer since 1998
Using TYPO3 since 2007
Certified TYPO3 integrator since 2011
Active contributer for TYPO3 CMS since 2013 (6.0)
Member of security and PHPUnit team
Working on multiple extensions as contributer
CPS-IT Mehr Wert im Netz 2
Checklist
General
Remove all include(), include_once(), require(), require_once()
Use convention over configuration for autoloading
Or at least an ext_autoload.php file
Adapt xclasses
Backend
Use „_DISPATCH“ as script configuration for backend modules
BackendUtility::getModuleUrl() and BackendUtility::getAjaxUrl()
CPS-IT Mehr Wert im Netz 3
Autoload
Cache lookup
Check for core file (namespace TYPO3\CMS\)
=> Class name reflects folder structure
Check runtime cache
=> filled with information by loaded ext_autoload.php files
Get file from class name („extbase convention“)
CPS-IT Mehr Wert im Netz 4
XCLASS
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Perm\\Controller\\PermissionModuleController'] = array(
'className' => 'Tx_BeAcl_Xclass_PermissionModuleController',
);
GeneralUtility::makeInstance()
Recursive dissolving
CPS-IT Mehr Wert im Netz 5
Dispatch
Changeinconf.php
$MCONF['script']= '_DISPATCH';
Remove in index.php
unset($MCONF);
require_once('conf.php');
require_once($BACK_PATH . 'init.php');
require_once($BACK_PATH . 'template.php');
CPS-IT Mehr Wert im Netz 6
Backend links
$url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(
$moduleName,
$urlParameters = array(),
$backPathOverride = FALSE,
$returnAbsoluteUrl = FALSE
);
CPS-IT Mehr Wert im Netz 7
Ajax links
Register your ajax script\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler(
‘myAjaxId’,
‘MyVendor\\myExtension\\Path\\To\\Class.php’
);
> Automatically published to TYPO3.settings.ajaxUrls[‘myAjaxId']
Use your ajax scriptExt.Ajax.request({
url: TYPO3.settings.ajaxUrls[‘myAjaxId']
});
CPS-IT Mehr Wert im Netz 8
Do‘s
Old class names still work due to class mapping
Old hook names still the same
Use signal / slots
CPS-IT Mehr Wert im Netz 9
Connect function to signal\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\
Dispatcher')->connect(
‘SignalClassName',
‘SignalName’,
‘SlotClassNameOrObject',
‘SlotMethodName'
);
Use signal / slots
Find signal
Function prefixed with “emit”
Calls dispatch() function from
TYPO3\CMS\Extbase\SignalSlot\Dispatcher
> This way you can introduce own signals
CPS-IT Mehr Wert im Netz 10
Don‘ts
General
Prevent any logic in ext_autoload.php configuration (e.g. require
other files)
No need for t3lib_div::loadTCA()
Eid scripts
No need to connect to database by tslib_eidtools::connectDB()
CPS-IT Mehr Wert im Netz 11
Don‘ts
Extbase
Database driven object are only stored by calling the repository
functions or persisted manually by calling$this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager‚
)->persistAll();
Disable the backport of the property mapper
plugin.tx_cpsblogexample.features.rewrittenPropertyMapper = 0
New functions in
TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
CPS-IT Mehr Wert im Netz 12
Thank youfor your attention!
Contact:
@IchHabRecht
typo3.slack.com
cps-it.cordes