<?php
/**
 * @package DJ-Catalog2-Yootheme
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

namespace DJExtensions\DJCatalog2\YOOtheme\Presets;
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use YOOtheme\Builder;
use YOOtheme\Builder\Source\SourceTransform;
use YOOtheme\Path;

return [

    'events' => [
        'customizer.init' => [
            PresetsListener::class => ['initCustomizer', -20]
        ],

    ],

    'routes' => [
        ['get', '/djcatalog2/presets', PresetsController::class . '@getPresets'],
        ['get', '/djcatalog2/presets/types', PresetsController::class . '@getTypes']
    ],

    'extend' => [

        Builder::class => function (Builder $builder, $app) {
            $presets = $app(Presets::class);

            if ($presets->isEnabled()) {
                $builder->addTransform('presave', new PresetSaveTransform);
                $builder->addTransform('prerender', new PresetTransform);
            }
        },

        Presets::class => function (Presets $presets, $app) {
            $presets->addTypesDir(__DIR__.'/presets'); // joomla specific
        },
    ],

    'services' => [
        Presets::class => ''
    ]

];
