<?php


namespace App\Brick\Handler;


use AutoAdmin\Bundle\BrickBuilder\Brick\Config\Configurator;
use AutoAdmin\Bundle\BrickBuilder\Brick\Handler\AbstractHtmlBrickHandler;
use AutoAdmin\Bundle\BrickBuilder\BrickType\BrickCategory;
use AutoAdmin\Bundle\BrickBuilder\Model\RenderingBrickInterface;
use Doctrine\Persistence\ManagerRegistry;

class /*HANDLER_CLASS_NAME*/BrickHandler extends AbstractHtmlBrickHandler
{
    public const BRICK_TYPE = 'brick./*HANDLER_BRICK_ID*/';

//    /**
//     * @var ManagerRegistry
//     */
//    private $doctrine;
//
//    public function __construct(ManagerRegistry $doctrine)
//    {
//        $this->doctrine = $doctrine;
//    }

    public function configure(Configurator $configurator)
    {
        parent::configure($configurator);

        $configurator->setTemplate('/brick//*HANDLER_BRICK_ID*/.html.twig');
        $configurator->setCategory(BrickCategory::CATEGORY_MISC);

//        $configurator->addSetting(
//            Setting::new('my_text')
//                ->setDefaultValue('')
//                ->setFormType(RichText::class)
//        );
    }

//    public function preRender(BrickInterface $brick, BrickHandlerManagerInterface $manager): RenderingBrickInterface
//    {
//        $renderBrick = parent::preRender($brick, $manager);
//        $brick = $renderBrick->getUnderlyingBrick();
//
//        $brick->setSetting('myvar', 'myvar');
//
//        return $renderBrick;
//    }
}