HanashiDev / dev.hanashi.wsc.wysiwyg-i18n-form

Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Does not work with WoltLab Suite 5.4 #2

Open dominik4545 opened 3 years ago

dominik4545 commented 3 years ago

Good evening,

I was very happy when I saw the plugin in the WoltLab Plugin Store! Unfortunately the plugin does not work for me :/

The message is Undefined index: availableLanguages

My Form looks like this:

<?php
namespace project\form;
use wcf\system\form\builder\container\wysiwyg\I18nWysiwygFormContainer;
use wcf\form\AbstractFormBuilderForm;

/**
 * Shows the project add form.
 *
 */
class ProjectAddForm extends AbstractFormBuilderForm {

    /**
     * {@inheritDoc}
     * @see \wcf\form\AbstractFormBuilderForm::$formAction
     */
    public $formAction = 'create';

    /**
     * {@inheritDoc}
     * @see \wcf\form\AbstractFormBuilderForm::$objectActionClass
     */
    public $objectActionClass = ProjectAction::class;    

    /**
     * {@inheritDoc}
     * @see \wcf\form\AbstractFormBuilderForm::createForm()
     */
    protected function createForm() {
        parent::createForm();

        $dataContainer = FormContainer::create('generalSection')
            ->appendChildren([
                // ...
            ]);

        $this->form->appendChildren([
            $dataContainer,
            I18nWysiwygFormContainer::create('text')
                ->label('project.item.text')
                ->messageLanguageItemPattern('project.item.text.\d+')
                ->messageObjectType('de.myDomain.project.item')
                ->minimumLength(3)
                ->required()
        ]);
    }
}

Is there anything wrong or is it a bug?

Hanashi commented 3 years ago

Hi, thank you. I will fix this tomorrow.

Hanashi commented 3 years ago

I tried it now and it worked for me in WSC 5.4. In which class is the error? Can you send the full error message, please?

Maybe it's interesting for you. The plugin "Simple FAQ" from TitusK uses the i18n WYSIWYG Form Field and it works in WSC 5.4. You could find the repository here: https://github.com/tkirchDev/dev.tkirch.wsc.faq

dominik4545 commented 3 years ago

Sure, the following error message was shown and is logged in the ACP:

Fri, 23 Jul 2021 16:29:33 +0000
Message: Undefined index: availableLanguages
PHP version: 7.2.24-0ubuntu0.18.04.8
WoltLab Suite version: 5.4.1
Request URI: GET /project/index.php?event-add/
Referrer: https://mydomain.de/project/index.php?event-add/
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0
Peak Memory Usage: 50814312/134217728
======
Error Class: wcf\system\exception\ErrorException
Error Message: Undefined index: availableLanguages
Error Code: 0
File: /var/www/mydomain.de/lib/system/WCF.class.php (344)
Extra Information: YToxOntpOjA7YToyOntpOjA7czoxNjoiVGVtcGxhdGUgQ29udGV4dCI7aToxO3M6NDEzOiI8P3BocAokdGhpcy0+dlsnZWxlbWVudElkZW50aWZpZXInXSA9ICd0aXRsZSc7CiR0aGlzLT52Wydmb3JjZVNlbGVjdGlvbiddID0gZmFsc2U7Cgo9PT09PiA/Pjw/cGhwIGlmIChjb3VudCgkdGhpcy0+dlsnYXZhaWxhYmxlTGFuZ3VhZ2VzJ10pID4gMSkgeyA/PgoJPHNjcmlwdCBkYXRhLXJlbG9jYXRlPSJ0cnVlIj4KCQlyZXF1aXJlKFsnTGFuZ3VhZ2UnLCAnV29sdExhYlN1aXRlL0NvcmUvTGFuZ3VhZ2UvSW5wdXQnLCAnV29sdExhYlN1aXRlL0NvcmUvTGFuZ3VhZ2UvVGV4dCddLCBmdW5jdGlvbihMYW5ndWFnZSwgTGFuZ3VhZ2VJbnB1dCwgTGFuZ3VhZ2VUZXh0KSB7CgkJCUxhbmd1YWdlLmFkZE9iamVjdCh7CgkJCQknd2NmLmdsb2JhbC5idXR0b24uZGlzYWJsZWRJMThuJzogJ2VpbnNwcmFjaGlnJwoJCQl9KTsKCQkJCiI7fX0=
Stack Trace: [{"file":"\/var\/www\/mydomain.de\/templates\/compiled\/0_project_1_projectAdd.php","line":2009,"function":"handleError","class":"wcf\\system\\WCF","type":"::","args":[8,"Undefined index: availableLanguages","\/var\/www\/mydomain.de\/templates\/compiled\/0_project_1_projectAdd.php",2009,{"templateName":"[redacted]","application":"[redacted]","sendHeaders":"[redacted]","sourceFilename":"[redacted]","compiledFilename":"[redacted]","metaDataFilename":"[redacted]","metaData":"[redacted]","_length1e6595daa97dc19d2d955483ed59a2a0fdbd519f":"[redacted]","_i1e6595daa97dc19d2d955483ed59a2a0fdbd519f":"[redacted]","_length70d8fd5365483f2070cf426be948cbe8578667be":"[redacted]","_i70d8fd5365483f2070cf426be948cbe8578667be":"[redacted]","_foreach_d236b3c23fd66630c4c57610c06a5180ac463565":"[redacted]","_foreach_c2ead078c8ff33947241dc5720ecfe3ce5bdea29":"[redacted]","_foreach_1be4d89ca80f4609c7a689ee8bf593677855b50d":"[redacted]","_foreach_abedd1e87ab494feb6c2d570fe589d1e9a66fe67":"[redacted]","_foreach_438de0eace2ca63697cbbcb3ffe033eba9ab41f6":"[redacted]","_foreach_a61503d9ba8dac1eac3bebad3140f2a51740ff9c":"[redacted]","_foreach_b8852002e3a28fdeedaa4632ab38f6d1c2f6af6b":"[redacted]","_foreach_d47719e79c5f2e049e9b098f024536b955024512":"[redacted]","_foreach_f7106be22180d71130191b5c5bd755feaed61937":"[redacted]","_foreach_93aa9ce4a925363eb470656ee3a54f3718f49f6f":"[redacted]"}]},{"file":"\/var\/www\/mydomain.de\/lib\/system\/template\/TemplateEngine.class.php","line":346,"args":["[error_during_sanitization]"],"function":"include","class":"","type":""},{"file":"\/var\/www\/mydomain.de\/lib\/page\/AbstractPage.class.php","line":371,"function":"display","class":"wcf\\system\\template\\TemplateEngine","type":"->","args":["projectAdd","project"]},{"file":"\/var\/www\/mydomain.de\/lib\/page\/AbstractPage.class.php","line":122,"function":"show","class":"wcf\\page\\AbstractPage","type":"->","args":[]},{"file":"\/var\/www\/mydomain.de\/lib\/system\/request\/Request.class.php","line":89,"function":"__run","class":"wcf\\page\\AbstractPage","type":"->","args":[]},{"file":"\/var\/www\/mydomain.de\/lib\/system\/request\/RequestHandler.class.php","line":119,"function":"execute","class":"wcf\\system\\request\\Request","type":"->","args":[]},{"file":"\/var\/www\/mydomain.de\/project\/index.php","line":4,"function":"handle","class":"wcf\\system\\request\\RequestHandler","type":"->","args":["project"]}]