Fix broken template paths in $Content

Use framework logic to get the templates of the current Widget Subclass
This commit is contained in:
wernerkrauss 2018-10-16 15:12:34 +02:00 committed by GitHub
parent 7d2dd46159
commit 5d2f0570d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\View\SSViewer;
/** /**
* Widgets let CMS authors drag and drop small pieces of functionality into * Widgets let CMS authors drag and drop small pieces of functionality into
@ -116,7 +117,7 @@ class Widget extends DataObject
*/ */
public function Content() public function Content()
{ {
return $this->renderWith(array_reverse(ClassInfo::ancestry(__CLASS__))); return $this->renderWith(SSViewer::get_templates_by_class(static::class));
} }
/** /**