PHP code example of medienbaecker / kirby-token-field

1. Go to this page and download the library: Download medienbaecker/kirby-token-field 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/ */

    

medienbaecker / kirby-token-field example snippets


// Associative array: key → saved value, value → label
'colors' => function () {
    return [
        'red-500'  => 'Red',
        'blue-500' => 'Blue',
    ];
}

// Array of arrays with value/text keys
'colors' => function () {
    return [
        ['value' => '#ff0000', 'text' => 'Red'],
        ['value' => '#0000ff', 'text' => 'Blue'],
    ];
}


// site/plugins/my-preview/index.php
Kirby::plugin('my/preview', []);

return [
    'panel' => [
        'css' => 'assets/css/panel.css'
    ]
];

return [
    'medienbaecker.token-field.font-family.text' => 'Hamburgevons',
    'medienbaecker.token-field.font-size.text'   => 'Abc',
];