<?php
/**
 * @package     DOCman
 * @copyright   Copyright (C) 2019 Timble CVBA. (http://www.timble.net)
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.joomlatools.com
 */

namespace Foliolabs\Docman;

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

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

        $this->setPath('foliolabs-docman/base/resources/assets/js/block/attachments.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('behavior.modal'); ?>
        <?= helper('translator.script', [
            'strings' => [
                'Behavior',
                'Layout',
                'Edit',
                'Select'
            ]
        ]); ?>
            ";

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

    }
}