Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Overwriting Core Classes


Reply

4 Posts   783 Views

Avatar
inkubux

29 October 2010 at 8:58am Community Member, 11 Posts

I want to know if there is a way to ovewrite silverstripe Core classes, od tell the cms to use my classes.

example.

if i put a core template in mysite/templates/TableListField.ss the cms will use my template

I want to achieve the same with the class it self eg : "MyTableListField extends TableListField" and tell the cms to use this class MyTableListField instead. or use the same technique as the DataObjectDecorator but I can't seem to find a way.

Any help would be appreciated.

Thank you very much

Avatar
Martijn

29 October 2010 at 10:19am Community Member, 271 Posts

I really +1 this request, but its not possible. Tried this several times with Object::use_custom_class(); but this won't override code FormFields.

So if someones knows a solution :)

Avatar
Hamish

29 October 2010 at 12:27pm Community Member, 712 Posts

Yeah, Object::use_custom_class only replaces objects created with Object::create. So, I guess we should be writing SS code using Object::create all the time, but no one does :/ so it is of limited use.

Avatar
inkubux

29 October 2010 at 1:46pm Community Member, 11 Posts

This would make a lot of sense. I really hope for this feature to be implemented :). It would really make the cms and the framework totally customizable whitout touching the core.

Just for the record it's possible to Subclass the ModelAdmin and Set a TableListClass with the resultsTableClassName proprety.

But it was tedious to find where to hook to change it.

By having the core written with Object::create it would actually be a charm.