Jump to:

23454 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Overwriting Core Classes

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

Page: 1
Go to End
Author Topic: 767 Views
  • inkubux
    Avatar
    Community Member
    11 Posts

    Overwriting Core Classes Link to this post

    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

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Overwriting Core Classes Link to this post

    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

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: Overwriting Core Classes Link to this post

    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.

  • inkubux
    Avatar
    Community Member
    11 Posts

    Re: Overwriting Core Classes Link to this post

    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.

    767 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.