PHP code example of thelia / thelia-blocks-module

1. Go to this page and download the library: Download thelia/thelia-blocks-module 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/ */

    

thelia / thelia-blocks-module example snippets



// ./EventListeners/TheliaBlocksPluginListener.php

namespace ModuleCitation\EventListeners;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use TheliaBlocks\Event\TheliaBlocksPluginsListEvent;

class TheliaBlocksPluginListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            TheliaBlocksPluginsListEvent::THELIA_BLOCKS_PLUGINS => ['registerPlugin'],
        ];
    }

    public function registerPlugin(TheliaBlocksPluginsListEvent $event): void
    {
        $event->addPlugin('ModuleCitation', [
            'js' => 'dist/index.global.js',
            'css' => 'dist/index.css',
        ]);
    }
}