[TYPO3-mvc] How to extend Felogin with Xclass (again)

Jigal van Hemert jigal.van.hemert at typo3.org
Tue Sep 17 11:57:28 CEST 2013


Hi,

On 16-9-2013 19:22, Markus Klein wrote:
> XCLASSing means you have to provide a complete copy of the original file modified by you.

No, the new class simply extends the old class and can override 
functions in the old class or add new data members and methods.

> It does NOT suffice to simply specify one method there, like overriding a method when extending a class.

It can be used to override one method. It's even possible to call the 
old method in your new version:

class ux_someclass extends someclass {

   public function foo($bar) {

     $result = parent::foo($bar);
     $result .= 'extra stuff';
     return $result;
   }
}

This way the code in the original function can change a bit but this 
will not influence the total functionality.

> This is the reason why XCLASSing is depracted.

It's not really deprecated. In 4.x versions it relied on some code in 
the end of the original class. This has been removed in 6.x and a new 
method for extending classes has been introduced:

http://wiki.typo3.org/XCLASS#XCLASS_registration_since_TYPO3_CMS_6.0

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-typo3v4mvc mailing list