Merge pull request #62 from jedateach/fortemplate

Added forTemplate function on Widget
This commit is contained in:
Michael Parkhill 2013-07-25 13:58:39 -07:00
commit 8e27c175a9

View File

@ -103,6 +103,17 @@ class Widget extends DataObject {
return $this->renderWith("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 * Renders the widget content in a custom template with the same name as the
* current class. This should be the main point of output customization. * current class. This should be the main point of output customization.