<?php

$this->helper('license')->require();

// events
$this->on('app.layout.assets', function(array &$assets, $context) {
    if ($context === 'app:footer') $assets[] = ['src' => 'personi:assets/js/personi.js', 'type' => 'module'];
});

$this->on('layout.components.collect', function($components) {

    $components['layoutVariants'] = [
        'label' => 'Layout Variants',
        'group' => 'Misc',
        'fields' => [
            [
                'name' => 'layout',
                'type' => 'variants',
                'opts' => [
                    'fields' => [
                        ['name' => 'layout', 'type' => 'layout']
                    ]
                ]
            ]
        ],
        'preview' => '<div class="kiss-padding-small"><span class="kiss-badge">{{ data.layout && Array.isArray(data.layout[\'personi:variants\']) ? data.layout[\'personi:variants\'].length: 0 }} {{ t(\'Variants\') }}</span></div>',
        'children' => false
    ];

});
