1. Go to this page and download the library: Download viget/viget-blocks-toolkit 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/ */
viget / viget-blocks-toolkit example snippets
/**
* @global array $block The block data.
* @global array $context The block context data.
* @global bool $is_preview Whether the block is being previewed.
* @global int $post_id The current post ID. (Be careful, you may want to use $context['postId'] when in a loop)
* @global \WP_Block $wp_block The WP_Block object.
*/
$block['url'] // The URL to the block folder.
$block['path'] // The path to the block folder.
$block['template'] // The template.json file contents.
$block['slug'] // The slug of the block, without the `acf/` prefix.
// Retrieve a specific block icon array.
vgtbt()->block_icons->get_icon( 'my-custom-icon' );