BUGFIX Fixed $add_action behaviour for SiteTree classes (through i18n_singular_name() method). Deprecated in favour of "<myclassname>.TITLE" entity to enable localized page titles. Limited add_action behaviour to SiteTree (was implemented on DataObject before)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@69878 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-01-08 01:39:59 +00:00 committed by Sam Minnee
parent bfe69a0715
commit 4e11307eae
2 changed files with 9 additions and 2 deletions

View File

@ -293,8 +293,7 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
* @return string User friendly translated singular name of this DataObject
*/
function i18n_singular_name() {
$name = (!empty($this->add_action)) ? $this->add_action : $this->singular_name();
return _t($this->class.'.SINGULARNAME', $name);
return _t($this->class.'.SINGULARNAME', $this->singular_name());
}
/**

View File

@ -138,6 +138,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* The text shown in the create page dropdown. If
* this is not set, default to "Create a ClassName".
*
* @deprecated 2.3 Use "<myclassname>.TITLE" in the i18n language tables instead
* @var string
*/
static $add_action = null;
@ -1763,6 +1765,12 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
);
}
function i18n_singular_name() {
$addAction = $this->stat('add_action');
$name = (!empty($addAction)) ? $addAction : $this->singular_name();
return _t($this->class.'.SINGULARNAME', $name);
}
/**
* Overloaded to also provide entities for 'Page' class which is usually
* located in custom code, hence textcollector picks it up for the wrong folder.