I'm trying to add some fields to the $PageComments form. To do this I use the DataObjectDecorator to extend the PageCommentInterface. To start simple I overload the PostCommentForm and alter the field 'Your name' to 'Your - test - name'. Problem is that the 'default' form with 'Your name' is showing. Hopefully someone could give me a clue on what I'm doing wrong here? Thanks!
===mysite/code/CustomCommentInterface.php===
class CustomCommentInterface extends DataObjectDecorator
{
function forTemplate()
{
return $this->renderWith('CustomCommentInterface');
}
function PostCommentForm() {
Requirements::javascript('jsparty/behaviour.js');
Requirements::javascript('jsparty/prototype.js');
Requirements::javascript('jsparty/scriptaculous/effects.js');
Requirements::javascript('cms/javascript/PageCommentInterface.js');
$fields = new FieldSet(
new HiddenField("ParentID", "ParentID", $this->page->ID),
new TextField("Name", _t('CustomCommentInterface.YOURNAME', 'Your - test - name')));
if(MathSpamProtection::isEnabled()){
$fields->push(new TextField("Math", sprintf(_t('CustomCommentInterface.SPAMQUESTION', "Spam protection question: %s"), MathSpamProtection::getMathQuestion())));
}
$fields->push(new TextareaField("Comment", _t('CustomCommentInterface.YOURCOMMENT', "Comments")));
$form = new PageCommentInterface_Form($this->controller, $this->methodName . ".PostCommentForm",$fields, new FieldSet(
new FormAction("postcomment", _t('CustomCommentInterface.POST', 'Post'))
));
$form->loadDataFrom(array(
"Name" => Cookie::get("CustomCommentInterface_Name"),
));
return $form;
}
}
===mysite/_config.php===
Object::add_extension('PageCommentInterface', 'CustomCommentInterface');