PHP code example of robbieaverill / silverstripe-markdowntextareafield

1. Go to this page and download the library: Download robbieaverill/silverstripe-markdowntextareafield library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robbieaverill / silverstripe-markdowntextareafield example snippets


class Page extends SiteTree {

    private static $db = array(
        'MarkdownContent' => 'MarkdownTextExtra',
    );

    public function getCMSFields() {
        $fields = parent::getCMSFields();

        $markdownfield = MarkdownTextareaField::create('MarkdownContent');
        $markdownfield->enableExtra(); // Enables extra syntax support for fields live preview.

        $fields->addFieldToTab('Root.Main', $markdownfield);        
        return $fields;
    }
}