Skip to content

Instantly share code, notes, and snippets.

@peterkraume
Last active December 20, 2015 05:19
Show Gist options
  • Save peterkraume/6077410 to your computer and use it in GitHub Desktop.
Save peterkraume/6077410 to your computer and use it in GitHub Desktop.
How to XCLASS an old TYPO3 extension without namespace support in TYPO3 6.x

How to XCLASS an old TYPO3 extension without namespace support in TYPO3 6.x

The TYPO3 Wiki explains only how to register a XCLASS using namespace support in TYPO3 6.x

But if you want to extend an older TYPO3 extensions which doesn't use namespaces, you need to circumvent some cliffs.

  1. ext_localconf.php

    Instead of specifying the namespace you only need to indicate the class name of the class you want to XCLASS.

  2. ext_autoload.php

    Since we don't stick to the TYPO3 convention we need to add the ext_autoload.php to tell TYPO3 where to look for the new class.

  3. class.ux_tx_solr_contentobject_relation.php

    Here goes your XCLASS code as usual.

<?php
class ux_tx_solr_contentobject_Relation extends tx_solr_contentobject_Relation {
// your stuff here
}
?>
<?php
$extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('myext');
return array(
'ux_tx_solr_contentobject_Relation' => $extensionPath . 'XCLASS/class.ux_tx_solr_contentobject_relation.php',
);
?>
<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['tx_solr_contentobject_Relation'] = array(
'className' => 'ux_tx_solr_contentobject_Relation');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment