From 96f2fa90fe37e21d58ff56519b67276d3c6aea5c Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Wed, 24 Jul 2013 13:49:25 +1200 Subject: [PATCH] Added forTemplate function on Widget --- code/model/Widget.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/model/Widget.php b/code/model/Widget.php index 13b4194..d2190f5 100644 --- a/code/model/Widget.php +++ b/code/model/Widget.php @@ -95,6 +95,17 @@ class Widget extends DataObject { public function WidgetHolder() { return $this->renderWith("WidgetHolder"); } + + /** + * Default way to render widget in templates. + * @return string HTML + */ + public function forTemplate($holder = true){ + if($holder){ + return $this->WidgetHolder(); + } + return $this->Content(); + } /** * Renders the widget content in a custom template with the same name as the