From 18912d2cb7420b4b5a094b279051cda183c36538 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 2 Nov 2008 20:04:26 +0000 Subject: [PATCH] ENHANCEMENT Added fieldLabels() overloading to various DataObject subclasses. Use this method instead of directly calling _t() in getCMSFields(), and use fieldLabel('MyField') to get the label for a specific FormField. This way, we can transparently support formfield scaffolding and re-use the labels for search fields automatically. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65073 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/sitefeatures/PageComment.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php index 5799d133..acdcf596 100755 --- a/code/sitefeatures/PageComment.php +++ b/code/sitefeatures/PageComment.php @@ -108,6 +108,16 @@ class PageComment extends DataObject { return self::$bbcode; } + function fieldLabels() { + $labels = parent::fieldLabels(); + $labels['Name'] = _t('PageComment.Name', 'Author Name'); + $labels['Comment'] = _t('PageComment.Comment', 'Comment'); + $labels['IsSpam'] = _t('PageComment.IsSpam', 'Spam?'); + $labels['NeedsModeration'] = _t('PageComment.NeedsModeration', 'Needs Moderation?'); + + return $labels; + } + }