Added forTemplate function on Widget

This commit is contained in:
Jeremy Shipman 2013-07-24 13:49:25 +12:00
parent c971289104
commit 96f2fa90fe
1 changed files with 11 additions and 0 deletions

View File

@ -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