PHP code example of amazingbv / statamic-gutenberg

1. Go to this page and download the library: Download amazingbv/statamic-gutenberg 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/ */

    

amazingbv / statamic-gutenberg example snippets


use Gutenberg;

echo Gutenberg::render($entry->get('content'));

use Gutenberg;

Gutenberg::block('project/notice', [
    'view' => 'blocks.notice',
]);

Gutenberg::block('custom/notice', function ($block, string $inner, $renderer): string {
    return view('blocks.notice', [
        'attrs' => $block->attributes(),
        'inner' => $inner,
    ])->render();
});

// config/statamic-gutenberg.php
'assets_container' => 'assets',



return [
    'core/paragraph' => [
        [
            'name' => 'lead',
            'label' => 'Lead',
            'style' => [
                'typography' => [
                    'fontSize' => 'var:preset|font-size|large',
                    'fontWeight' => '700',
                ],
            ],
        ],
    ],
    [
        'blocks' => ['core/heading', 'core/paragraph'],
        'name' => 'eyebrow',
        'label' => 'Eyebrow',
        'style' => [
            'typography' => [
                'fontSize' => '0.875rem',
                'fontWeight' => '700',
                'textTransform' => 'uppercase',
            ],
        ],
    ],
];

'block_styles' => [
    'core/button' => [
        [
            'name' => 'brand-button',
            'label' => 'Brand button',
            'style' => [
                'border' => [
                    'color' => 'var:preset|color|brand',
                ],
            ],
        ],
    ],
],

use Gutenberg;

Gutenberg::blockStyle('core/paragraph', [
    'name' => 'lead',
    'label' => 'Lead',
    'style' => [
        'typography' => [
            'fontWeight' => '700',
        ],
    ],
]);



return [
    'check' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>',

    'alert' => [
        'label' => 'Alert',
        'svg' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2 2 22h20z"/></svg>',
    ],
];

'icons' => [
    'arrow-right' => [
        'label' => 'Arrow right',
        'svg' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h14M13 5l7 7-7 7"/></svg>',
    ],
],



$class = trim('amazing-notice '.($attributes['className'] ?? ''));

bash
php artisan vendor:publish --tag=statamic-gutenberg --force
php artisan optimize:clear
bash
php artisan vendor:publish --tag=statamic-gutenberg --force
text
config/statamic-gutenberg.php
text
/vendor/statamic-gutenberg/theme/...
text
resources/vendor/statamic-gutenberg/block-styles.php
text
resources/vendor/statamic-gutenberg/icons.php
bash
php artisan vendor:publish --tag=statamic-gutenberg-patterns
text
/vendor/statamic-gutenberg/blocks/...
bash
cd /path/to/laravel-statamic-project
php artisan vendor:publish --tag=statamic-gutenberg --force
php artisan optimize:clear
bash
composer show amazingbv/statamic-gutenberg
php artisan optimize:clear