[TYPO3-dev] Get extKey from classname

Dmitry Dulepov [typo3] dmitry at typo3.org
Fri Aug 22 11:48:57 CEST 2008


Hi!

Steffen Kamper wrote:
> yes, but underscore is extracted (not reproducable) and the ending is 
> free too ("_pi1" as default, but can also be "controller" or anything else.

function getKeyByClassName($className) {
	foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $key => $data) {
		if (substr($className, 0, strlen($data['classPrefix']])) == $data['classPrefix']) {
			return $key;
		}
	}
	return false;
}

Now the only task is to set classPrefix to $GLOBALS['TYPO3_LOADED_EXT'].

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/pages/book-reviews/presentation-zen-by-garr-reynolds/




More information about the TYPO3-dev mailing list