mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
bfe69a0715
commit
4e11307eae
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user