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.

Archive /

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

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

setAddTitle()


Reply


5 Posts   1373 Views

Avatar
UncleCheese

Forum Moderator, 4096 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

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, 4096 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

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, 4096 Posts

25 September 2008 at 1:18am

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