silverstripe /
silverstripe-content-widget
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SilverStripe\ContentWidget; |
||
| 4 | |||
| 5 | use SilverStripe\Forms\FieldList; |
||
| 6 | use SilverStripe\Forms\TextField; |
||
| 7 | use SilverStripe\Forms\HTMLEditor\HTMLEditorField; |
||
| 8 | use SilverStripe\Widgets\Model\Widget; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Content Widget |
||
| 12 | */ |
||
| 13 | class ContentWidget extends Widget |
||
| 14 | { |
||
| 15 | private static $db = [ |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 16 | "HTML" => "HTMLText", |
||
| 17 | ]; |
||
| 18 | |||
| 19 | private static $title = "Content"; |
||
| 20 | |||
| 21 | private static $cmsTitle = "Content"; |
||
| 22 | |||
| 23 | private static $description = "Custom rich content widget."; |
||
| 24 | |||
| 25 | private static $table_name = 'ContentWidget'; |
||
|
0 ignored issues
–
show
|
|||
| 26 | |||
| 27 | /** |
||
| 28 | * @return FieldList |
||
| 29 | */ |
||
| 30 | public function getCMSFields() |
||
| 31 | { |
||
| 32 | $fields = parent::getCMSFields(); |
||
| 33 | |||
| 34 | $fields->push(TextField::create("Title")); |
||
| 35 | $fields->push(HTMLEditorField::create("HTML", "Content")); |
||
| 36 | |||
| 37 | return $fields; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |