PHP code example of webfox / silverstripe-global-content

1. Go to this page and download the library: Download webfox/silverstripe-global-content 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/ */

    

webfox / silverstripe-global-content example snippets


class GlobalContentExtension extends DataExtension 
{

    protected static $db = [
        'MyFieldName' => 'Varchar'
    ];
    
    public function updateCMSFields(FieldList $fields)
    {
    
        $fields->addFieldToTab(
            'Root.Main', 
            TextField::create('MyFieldName', 'My field name')
        );
    
    }

}