<commit_before><?php
class Kwc_Basic_Text_Form extends Kwc_Abstract_Form
{
    public function __construct($name, $class, $id = null)
    {
        $this->setModel(Kwc_Basic_Text_Component::createOwnModel($class));
        parent::__construct($name, $class, $id);
        $field = new Kwf_Form_Field_HtmlEditor('content', trlKwf('Text'));
        $field->setData(new Kwc_Basic_Text_ContentData('content'));
        $field->setHideLabel(true);

        $ignoreSettings = array('tablename', 'componentName',
                'default', 'assets', 'assetsAdmin',
                'placeholder', 'plugins');
        $c = strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class;
        foreach (call_user_func(array($c, 'getSettings')) as $key => $val) {
            if (!in_array($key, $ignoreSettings)) {
                $method = 'set' . ucfirst($key);
                $field->$method($val);
            }
        }
        $generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
        $classes = isset($generators['child']) ? $generators['child']['component'] : array();
        if (isset($classes['link']) && $classes['link']) {
            $cfg = new Kwf_Component_Abstract_ExtConfig_Form($classes['link']);
            $c = $cfg->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
            $field->setLinkComponentConfig($c['form']);
        }
        if (isset($classes['image']) && $classes['image']) {
            $c = Kwc_Admin::getInstance($classes['image'])->getExtConfig();
            $field->setImageComponentConfig($c['form']);
        }
        if (isset($classes['download']) && $classes['download']) {
            $c = Kwc_Admin::getInstance($classes['download'])->getExtConfig();
            $field->setDownloadComponentConfig($c['form']);
        }
        if (Kwc_Abstract::getSetting($this->getClass(), 'enableStylesEditor')) {
            $admin = Kwc_Admin::getInstance($class);
            $field->setStylesEditorConfig(array(
                'xtype' => 'kwc.basic.text.styleseditor',
                'blockStyleUrl' => $admin->getControllerUrl('BlockStyle'),
                'inlineStyleUrl' => $admin->getControllerUrl('InlineStyle'),
                'masterStyleUrl' => $admin->getControllerUrl('MasterStyle')
            ));
        }

        $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($class, 'stylesModel'));
        $field->setStyles($t->getStyles());
        $field->setComponentClass($class);

        $field->setControllerUrl(Kwc_Admin::getInstance($class)->getControllerUrl());
        $this->fields->add($field);

        $this->setAssetsPackage(Kwf_Assets_Package_Default::getInstance('Frontend'));
    }

    //für tests
    public function setAssetsPackage(Kwf_Assets_Package $package)
    {
        $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->getClass(), 'stylesModel'));

        $urls = $package->getPackageUrls('text/css', Kwf_Trl::getInstance()->getTargetLanguage());

        $styleEditorUrl = Kwc_Admin::getInstance($this->getClass())->getControllerUrl().'/styles-content';
        $styleEditorUrl .= '?t='.$t->getMTime();
        $urls[] = $styleEditorUrl;

        $this->fields['content']->setStylesCssFile($styleEditorUrl);
        $this->fields['content']->setCssFiles($urls);
    }

    public function setHtmlEditorLabel($title)
    {
        $this->getHtmlEditor()
            ->setFieldLabel($title)
            ->setHideLabel(false);
        return $this;
    }
    public function setHtmlEditorHeight($height)
    {
        $this->getHtmlEditor()->setHeight($height);<commit_msg>Set CSS-Urls for RTE-Iframe<commit_after><?php
class Kwc_Basic_Text_Form extends Kwc_Abstract_Form
{
    public function __construct($name, $class, $id = null)
    {
        $this->setModel(Kwc_Basic_Text_Component::createOwnModel($class));
        parent::__construct($name, $class, $id);
        $field = new Kwf_Form_Field_HtmlEditor('content', trlKwf('Text'));
        $field->setData(new Kwc_Basic_Text_ContentData('content'));
        $field->setHideLabel(true);

        $ignoreSettings = array('tablename', 'componentName',
                'default', 'assets', 'assetsAdmin',
                'placeholder', 'plugins');
        $c = strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class;
        foreach (call_user_func(array($c, 'getSettings')) as $key => $val) {
            if (!in_array($key, $ignoreSettings)) {
                $method = 'set' . ucfirst($key);
                $field->$method($val);
            }
        }
        $generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
        $classes = isset($generators['child']) ? $generators['child']['component'] : array();
        if (isset($classes['link']) && $classes['link']) {
            $cfg = new Kwf_Component_Abstract_ExtConfig_Form($classes['link']);
            $c = $cfg->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
            $field->setLinkComponentConfig($c['form']);
        }
        if (isset($classes['image']) && $classes['image']) {
            $c = Kwc_Admin::getInstance($classes['image'])->getExtConfig();
            $field->setImageComponentConfig($c['form']);
        }
        if (isset($classes['download']) && $classes['download']) {
            $c = Kwc_Admin::getInstance($classes['download'])->getExtConfig();
            $field->setDownloadComponentConfig($c['form']);
        }
        if (Kwc_Abstract::getSetting($this->getClass(), 'enableStylesEditor')) {
            $admin = Kwc_Admin::getInstance($class);
            $field->setStylesEditorConfig(array(
                'xtype' => 'kwc.basic.text.styleseditor',
                'blockStyleUrl' => $admin->getControllerUrl('BlockStyle'),
                'inlineStyleUrl' => $admin->getControllerUrl('InlineStyle'),
                'masterStyleUrl' => $admin->getControllerUrl('MasterStyle')
            ));
        }

        $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($class, 'stylesModel'));
        $field->setStyles($t->getStyles());
        $field->setComponentClass($class);

        $field->setControllerUrl(Kwc_Admin::getInstance($class)->getControllerUrl());
        $this->fields->add($field);

        $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->getClass(), 'stylesModel'));

        $urls = array();
        if (Kwf_Assets_WebpackConfig::getDevServerUrl()) {
            $urls[] = Kwf_Assets_WebpackConfig::getDevServerUrl() . 'assets/build/Frontend.css';
        } else {
            $urls[] = 'build/assets/Frontend.css';
        }
        $styleEditorUrl = Kwc_Admin::getInstance($this->getClass())->getControllerUrl().'/styles-content';
        $styleEditorUrl .= '?t='.$t->getMTime();
        $urls[] = $styleEditorUrl;

        $this->fields['content']->setStylesCssFile($styleEditorUrl);
        $this->fields['content']->setCssFiles($urls);
    }

    public function setHtmlEditorLabel($title)
    {
        $this->getHtmlEditor()
            ->setFieldLabel($title)
            ->setHideLabel(false);
        return $this;
    }
    public function setHtmlEditorHeight($height)
    {
        $this->getHtmlEditor()->setHeight($height);
{'fraction_non_alphanumeric': 0.174434638720353, 'fraction_numerical': 0.0002757859900717044, 'mean_word_length': 3.088500563697858, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 88, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3674446', 'n_tokens_mistral': 2106, 'n_tokens_neox': 2086, 'n_words': 264}