<?php
/**
 * @package     DOCman
 * @copyright   Copyright (C) 2019 Timble CVBA. (http://www.timble.net)
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        https://github.com/foliolabs/docman for the canonical source repository
 */

namespace Foliolabs\Docman;

use Foliolabs\Component\Base;
use Foliolabs\Library;

class BlockScriptFlat extends Base\BlockScriptExternal
{
    public function __construct(Library\ObjectConfig $config)
    {
        parent::__construct($config);

        $this->setPath('foliolabs-docman/base/resources/assets/js/block/flat.js');
    }

    public function beforeEnqueue()
    {
        parent::beforeEnqueue();

        BlockScriptCommon::addCommonScripts();

        $view = $this->getObject('com:docman.view.default.html');
        $template = $view->getTemplate()
                         ->addFilter('style')
                         ->addFilter('script');

        $string = "
        <?= helper('ui.styles', [
            'package' => 'docman',
            'domain' => 'site',
            'file' => 'block',
            'dark_mode' => false
        ]); ?>
        <?= helper('translator.script', [
            'strings' => [
                'Document options',
            ]
        ]); ?>
        <?= helper('behavior.jquery'); ?>
            ";

        $template->render($string, [], 'php');

    }
}
