Skip to content

Example registration

Kelly Mears edited this page Nov 29, 2019 · 1 revision
/**
 * Plugin Name: Tiny Pixel Blocks
 * Description: WordPress block editor components
 */
add_filter('blockmodules', function ($registrar) {
    $registrar->addPlugin('tiny-pixel-blocks', [
        'dir'  => 'tiny-pixel-blocks',
    ]);

    $registrar->addBlock('tiny-pixel-blocks', [
      'handle'    => 'tiny-pixel/block',
      'dir'       => 'block',            
      'filepaths' => [
        'views' => 'resources/views',  
        'dist'  => 'dist',            
      ],
      'editor'  => [
        'js'  => 'scripts/editor',
        'css' => 'styles/editor',  
      ],
      'public'  => [
        'js'  => 'scripts/public',
        'css' => 'styles/public',
      ],
      'view'   => 'block.blade.php',
      'layout' => 'block-modules/resources/views/layouts/block.blade.php',
  ]);
});
Clone this wiki locally