mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Reverted 'single instance only' feature from r79868, delayed until later release (see #4277) (from r97182)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102431 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a36f4bdac7
commit
3fe5af85a4
@ -139,11 +139,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
*/
|
*/
|
||||||
static $can_create = true;
|
static $can_create = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* If this is true, users can create only one instance of this class in the CMS.
|
|
||||||
*/
|
|
||||||
static $single_instance_only = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icon to use in the CMS
|
* Icon to use in the CMS
|
||||||
*
|
*
|
||||||
@ -832,8 +828,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @return boolean True if the current user can create pages on this class.
|
* @return boolean True if the current user can create pages on this class.
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null) {
|
public function canCreate($member = null) {
|
||||||
if($this->stat('single_instance_only') && DataObject::get_one($this->class)) return false;
|
|
||||||
|
|
||||||
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
|
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
|
||||||
$member = Member::currentUserID();
|
$member = Member::currentUserID();
|
||||||
}
|
}
|
||||||
@ -847,6 +841,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
return $this->stat('can_create') != false || Director::isDev();
|
return $this->stat('can_create') != false || Director::isDev();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function should return true if the current user can edit this
|
* This function should return true if the current user can edit this
|
||||||
* page. It can be overloaded to customise the security model for an
|
* page. It can be overloaded to customise the security model for an
|
||||||
@ -2315,9 +2310,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
if(!$this->ShowInMenus)
|
if(!$this->ShowInMenus)
|
||||||
$classes .= " notinmenu";
|
$classes .= " notinmenu";
|
||||||
|
|
||||||
if($this->stat('single_instance_only'))
|
|
||||||
$classes .= " singleinstance";
|
|
||||||
|
|
||||||
//TODO: Add integration
|
//TODO: Add integration
|
||||||
/*
|
/*
|
||||||
if($this->hasExtension('Translatable') && $controller->Locale != Translatable::default_locale() && !$this->isTranslation())
|
if($this->hasExtension('Translatable') && $controller->Locale != Translatable::default_locale() && !$this->isTranslation())
|
||||||
|
Loading…
Reference in New Issue
Block a user