mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Added CMSTreeClasses() methods to Group and Folder, to mirror SiteTree behaviour and allow reusage in CMS tree implementations
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92567 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
253dc1e24e
commit
84125b4416
@ -464,6 +464,26 @@ HTML;
|
|||||||
function ChildFolders() {
|
function ChildFolders() {
|
||||||
return DataObject::get("Folder", "\"ParentID\" = " . (int)$this->ID);
|
return DataObject::get("Folder", "\"ParentID\" = " . (int)$this->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
function CMSTreeClasses($controller) {
|
||||||
|
$classes = sprintf('class-%s', $this->class);
|
||||||
|
|
||||||
|
if(!$this->canDelete())
|
||||||
|
$classes .= " nodelete";
|
||||||
|
|
||||||
|
if($controller->isCurrentPage($this))
|
||||||
|
$classes .= " current";
|
||||||
|
|
||||||
|
if(!$this->canEdit())
|
||||||
|
$classes .= " disabled";
|
||||||
|
|
||||||
|
$classes .= $this->markingClasses();
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Folder_UnusedAssetsField extends CompositeField {
|
class Folder_UnusedAssetsField extends CompositeField {
|
||||||
|
@ -436,6 +436,26 @@ class Group extends DataObject {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
function CMSTreeClasses($controller) {
|
||||||
|
$classes = sprintf('class-%s', $this->class);
|
||||||
|
|
||||||
|
if(!$this->canDelete())
|
||||||
|
$classes .= " nodelete";
|
||||||
|
|
||||||
|
if($controller->isCurrentPage($this))
|
||||||
|
$classes .= " current";
|
||||||
|
|
||||||
|
if(!$this->canEdit())
|
||||||
|
$classes .= " disabled";
|
||||||
|
|
||||||
|
$classes .= $this->markingClasses();
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user