PHP code example of heyday / silverstripe-colorpalette

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

    

heyday / silverstripe-colorpalette example snippets


$fields->addFieldToTab(
    'Root.Main',
    Heyday\ColorPalette\Fields\ColorPaletteField::create(
        'BackgroundColor',
        'Background Color',
        [
            'White' => '#fff',
            'Black' => '#000'
        ]
    )
);

$fields->addFieldToTab(
    'Root.Main',
    Heyday\ColorPalette\Fields\GroupedColorPaletteField::create(
        'BackgroundColor',
        'Background Color',
        array(
            'Primary Palette' => [
                'White' => '#fff',
                'Black' => '#000'
            ],
            'Secondary Palette' => [
                'Blue' => 'blue',
                'Red' => 'red'
            ]
        )
    )
);