mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 15:05:54 +00:00
Added forTemplate function on Widget
This commit is contained in:
parent
c971289104
commit
96f2fa90fe
@ -96,6 +96,17 @@ class Widget extends DataObject {
|
||||
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
|
||||
* current class. This should be the main point of output customization.
|
||||
|
Loading…
x
Reference in New Issue
Block a user