Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » setAddTitle()

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1332 Views
  • UncleCheese
    Avatar
    4085 Posts

    setAddTitle() Link to this post

    Why is setAddTitle() only available in extensions of ComplexTableField and not in just a plain CTF? Was this an oversight? Seems odd.

    Anyone have a workaround?

  • Phalkunz
    Avatar
    69 Posts

    Re: setAddTitle() Link to this post

    If by extension you mean subclass then it's not odd. it's because subclass is supposed to have all the features that superclass has plus extra feature(s).

    For some reasons, if you want only the functionality provided by ctf and only setAddTitle() function, you have to subclass ctf and add this function to the subclass. Also make sure you define a variable to hold addTitle and set the $template variable to a new template that you'll create to display addTitle.

  • UncleCheese
    Avatar
    4085 Posts

    Re: setAddTitle() Link to this post

    I see. Still seems like an odd design choice, though. I understand what you mean by "extra features," but all of the immediate subclasses of CTF has this feature. Save some code and just put that feature in the class above it, you know?

    And it's more than just adding a function. Now i have to go into the CTF template and make it aware of my addTitle variable for the add button.

  • Phalkunz
    Avatar
    69 Posts

    Re: setAddTitle() Link to this post

    Just out of curiosity, why you don't use subclasses of ctf instead when they're providing the feature that you need.

    My suggestion earlier is not a good practice. you might wanna look at the code more closely to whether ctf class really doesn't allow us to do so.

  • UncleCheese
    Avatar
    4085 Posts

    Re: setAddTitle() Link to this post

    The subclasses of CTF are HasManyCTF and HasOneCTF... I just need a plain ol' CTF!

    1332 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.