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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

setAddTitle()


Go to End


5 Posts   1626 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

24 September 2008 at 7:28am

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?

Avatar
Phalkunz

Community Member, 69 Posts

24 September 2008 at 9:49pm

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

25 September 2008 at 12:43am

Edited: 25/09/2008 12:45am

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.

Avatar
Phalkunz

Community Member, 69 Posts

25 September 2008 at 1:04am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

25 September 2008 at 1:18am

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