Permalink
Browse files

ENHANCEMENT Setting default group title in Group->populateDefaults()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92564 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
chillu committed Nov 21, 2009
1 parent b1300f7 commit 58cfa9ffca7bf0ec790866f9aec36c313eadd055
Showing with 10 additions and 1 deletion.
  1. +10 −1 security/Group.php
View
@@ -180,6 +180,15 @@ function fieldLabels($includerelations = true) {
return $labels;
}
+ function populateDefaults() {
+ parent::populateDefaults();
+
+ if(!$this->Title) $this->Title = sprintf(
+ _t('GROUP.NEWITEM',"New %s"),
+ singleton($this->class)->i18n_singular_name()
+ );
+ }
+
/**
* Add a member to a group.
*
@@ -313,7 +322,7 @@ public function setCode($val){
function onBeforeWrite() {
parent::onBeforeWrite();
-
+
if(stripos($this->Code, 'new-') === 0) {
$this->setCode($this->Title);
}

0 comments on commit 58cfa9f

Please sign in to comment.