<commit_before><?php

namespace Mapbender\CoreBundle\Element;

use Mapbender\CoreBundle\Component\Element;

class HTMLElement extends Element
{

    /**
     * @inheritdoc
     */
    public static function getClassTitle()
    {
        return "mb.core.htmlelement.class.title";
    }

    /**
     * @inheritdoc
     */
    public static function getClassDescription()
    {
        return "mb.core.htmlelement.class.description";
    }

    /**
     * @inheritdoc
     */
    public static function getClassTags()
    {
        return array(
            "mb.core.htmlelement.tag.html");
    }

    /**
     * @inheritdoc
     */
    static public function listAssets()
    {
        return array(
            'js' => array('mapbender.element.htmlelement.js'),
            'css' => array('sass/element/htmlelement.scss')
        );
    }

    /**
     * @inheritdoc
     */
    public static function getType()
    {
        return 'Mapbender\CoreBundle\Element\Type\HTMLElementAdminType';
    }

    /**
     * @inheritdoc
     */
    public static function getDefaultConfiguration()
    {
        return array(
            'classes' => 'html-element-inline'
        );
    }

    /**
     * @inheritdoc
     */
    public function getWidgetName()
    {
        return 'mapbender.mbHTMLElement';
    }

    /**
     * @inheritdoc
     */
    public function render()
    {
        return $this->container->get('templating')
                ->render('MapbenderCoreBundle:Element:htmlelement.html.twig',
                    array(
                    'id'            => $this->getId(),
                    'entity'        => $this->entity,
                    'application'   => $this->application,
                    'configuration' => $this->getConfiguration()));
    }

    /**
     * @inheritdoc
     */
    public static function getFormTemplate()
    {
        return 'MapbenderCoreBundle:ElementAdmin:htmlelement.html.twig';
    }

    static public function getFormAssets()
    {
        return array(
            'js' => array(
                'bundles/mapbendermanager/codemirror/lib/codemirror.js',
                'bundles/mapbendermanager/codemirror/mode/xml/xml.js',
                'bundles/mapbendermanager/codemirror/keymap/sublime.js',
                'bundles/mapbendermanager/codemirror/addon/selection/active-line.js',
                'bundles/mapbendercore/mapbender.admin.htmlelement.js',
            ),
            'css' => array(
                'bundles/mapbendermanager/codemirror/lib/codemirror.css',
                'bundles/mapbendermanager/codemirror/theme/neo.css',
            )
        );
    }

}
<commit_msg>add ability to add  custom javascript to the HTMLElement<commit_after><?php

namespace Mapbender\CoreBundle\Element;

use Mapbender\CoreBundle\Component\Element;

class HTMLElement extends Element
{

    /**
     * @inheritdoc
     */
    public static function getClassTitle()
    {
        return "mb.core.htmlelement.class.title";
    }

    /**
     * @inheritdoc
     */
    public static function getClassDescription()
    {
        return "mb.core.htmlelement.class.description";
    }

    /**
     * @inheritdoc
     */
    public static function getClassTags()
    {
        return array(
            "mb.core.htmlelement.tag.html");
    }

    /**
     * @inheritdoc
     */
    static public function listAssets()
    {
        return array(
            'js' => array('mapbender.element.htmlelement.js'),
            'css' => array('sass/element/htmlelement.scss')
        );
    }

    public function getAssets()
    {
        $configuration = $this->getConfiguration();
        $assets = parent::getAssets();
        if(isset($configuration['js'])){
            $assets['js'][] = $configuration['js'];
        }
        return $assets;
    }

    /**
     * @inheritdoc
     */
    public static function getType()
    {
        return 'Mapbender\CoreBundle\Element\Type\HTMLElementAdminType';
    }

    /**
     * @inheritdoc
     */
    public static function getDefaultConfiguration()
    {
        return array(
            'classes' => 'html-element-inline'
        );
    }

    /**
     * @inheritdoc
     */
    public function getWidgetName()
    {
        return 'mapbender.mbHTMLElement';
    }

    /**
     * @inheritdoc
     */
    public function render()
    {
        return $this->container->get('templating')
                ->render('MapbenderCoreBundle:Element:htmlelement.html.twig',
                    array(
                    'id'            => $this->getId(),
                    'entity'        => $this->entity,
                    'application'   => $this->application,
                    'configuration' => $this->getConfiguration()));
    }

    /**
     * @inheritdoc
     */
    public static function getFormTemplate()
    {
        return 'MapbenderCoreBundle:ElementAdmin:htmlelement.html.twig';
    }

    static public function getFormAssets()
    {
        return array(
            'js' => array(
                'bundles/mapbendermanager/codemirror/lib/codemirror.js',
                'bundles/mapbendermanager/codemirror/mode/xml/xml.js',
                'bundles/mapbendermanager/codemirror/keymap/sublime.js',
                'bundles/mapbendermanager/codemirror/addon/selection/active-line.js',
                'bundles/mapbendercore/mapbender.admin.htmlelement.js',
            ),
            'css' => array(
                'bundles/mapbendermanager/codemirror/lib/codemirror.css',
                'bundles/mapbendermanager/codemirror/theme/neo.css',
            )
        );
    }

}

{'fraction_non_alphanumeric': 0.12544674767691208, 'fraction_numerical': 0.0, 'mean_word_length': 1.7463199214916585, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4146040', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1646, 'n_words': 228}