PHP code example of wrux / blocky

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

    

wrux / blocky example snippets


   

   return [
     'textBlock' => 'app\blocks\TextBlock',
   ];
   

   

   namespace app\blocks;

   use wrux\blocky\Block;

   class TextBlock extends Block {

     public string $template = 'text.twig';

     public function getContext(): array {
       return [
         'text' => !empty($this->block->contentHtml)
           ? $this->block->contentHtml->getParsedContent()
           : NULL,
       ];
     }
   }