mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR make widgetarea/editor more suitable for generic use (from r95086)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95632 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b1bf03ffd1
commit
3a982497aa
@ -12,7 +12,12 @@
|
||||
*/
|
||||
class Widget extends DataObject {
|
||||
static $db = array(
|
||||
"Sort" => "Int"
|
||||
"Sort" => "Int",
|
||||
"Enabled" => "Boolean"
|
||||
);
|
||||
|
||||
static $defaults = array(
|
||||
'Enabled' => true
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
@ -22,7 +27,6 @@ class Widget extends DataObject {
|
||||
static $has_many = array();
|
||||
static $many_many = array();
|
||||
static $belongs_many_many = array();
|
||||
static $defaults = array();
|
||||
|
||||
static $default_sort = "Sort";
|
||||
|
||||
|
@ -18,6 +18,8 @@ class WidgetArea extends DataObject {
|
||||
|
||||
static $belongs_many_many = array();
|
||||
|
||||
public $template = __CLASS__;
|
||||
|
||||
/**
|
||||
* Used in template instead of {@link Widgets()}
|
||||
* to wrap each widget in its controller, making
|
||||
@ -45,15 +47,19 @@ class WidgetArea extends DataObject {
|
||||
}
|
||||
|
||||
function Items() {
|
||||
return $this->Widgets();
|
||||
return $this->getComponents('Widgets');
|
||||
}
|
||||
|
||||
function ItemsToRender() {
|
||||
return $this->Items();
|
||||
return $this->getComponents('Widgets', "Widget.Enabled = 1");
|
||||
}
|
||||
|
||||
function forTemplate() {
|
||||
return $this->renderWith($this->class);
|
||||
return $this->renderWith($this->template);
|
||||
}
|
||||
|
||||
function setTemplate($template) {
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
function onBeforeDelete() {
|
||||
|
Loading…
Reference in New Issue
Block a user