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   825 Views

Avatar
inkubux

Community Member, 11 Posts

29 October 2010 at 8:58am

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

Community Member, 271 Posts

29 October 2010 at 10:19am

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

Community Member, 712 Posts

29 October 2010 at 12:27pm

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

Community Member, 11 Posts

29 October 2010 at 1:46pm

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.