PHP code example of getolympus / olympus-dionysos-field-code

1. Go to this page and download the library: Download getolympus/olympus-dionysos-field-code 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/ */

    

getolympus / olympus-dionysos-field-code example snippets


return \GetOlympus\Dionysos\Field\Code::build('my_code_field_id', [
    'title'       => 'How do Penguins code their icebergs?',
    'default'     => 'With a frozen bug.',
    'description' => 'A simple question to let you know how to seduce a penguin.',
    'mode'        => 'json',
    'rows'        => 4,

    /**
     * Code mirror settings
     * @see https://developer.wordpress.org/reference/functions/wp_get_code_editor_settings/
     */
    'settings' => [
        'indentUnit'     => 2,
        'indentWithTabs' => false,
        'tabSize'        => 2,
    ],
]);

// Get code from Database
$code = get_option('my_code_field_id', '');

// Display code in HTML tag
echo '<pre>'.htmlspecialchars($code).'</pre>';