ENHANCEMENT: Allow, via extension configuration, the addition of Twitter handle for comments

This commit is contained in:
Gordon Anderson 2015-02-07 12:11:16 +07:00
parent 2a20037e49
commit a88fc21cde
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<?php
class CommentTwitterUsernameExtension extends DataExtension {
// maximum length of a twitter usnername is 15 chars
private static $db = array('TwitterUsername'=>'Varchar(16)');
}

View File

@ -0,0 +1,11 @@
<?php
class CommentingControllerTwitterUsernameExtension extends DataExtension {
public function alterCommentForm(&$form) {
$fields = $form->Fields();
// FIXME order
$fields->insertBefore($tf = new TextField('TwitterUsername','Twitter Username'), 'Comment');
}
}