contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
123 stars 58 forks source link

Bug in MetaWizard widget #1696

Closed pgerundt closed 5 years ago

pgerundt commented 5 years ago

Steps to reproduce: 1) Add a new language 2) Enter data 3) Save

When deleting the recently added language, a JS error is thrown.

Cause: The metaDelete() method in core.js tries to re-enable the language in the select field: https://github.com/contao/core-bundle/blob/df6731c478a9f18a1a4f94f0882e89656ccc7ea0/src/Resources/public/core.js#L2329

But the select field does not contain (disabled) language options of currently used languages.

Maybe the language should not be removed from the select field: https://github.com/contao/core-bundle/blob/df6731c478a9f18a1a4f94f0882e89656ccc7ea0/src/Resources/contao/widgets/MetaWizard.php#L166

But instead the active languages should be added with the "disabled" attribute to the select: https://github.com/contao/core-bundle/blob/df6731c478a9f18a1a4f94f0882e89656ccc7ea0/src/Resources/contao/widgets/MetaWizard.php#L179

Maybe something like this (totally untested): $options[] = '<option value="' . $k . '"' . ($this->varValue[$k] ? ' disabled="disabled"' : '') . '>' . $v . '</option>'; and removing theunset()

pgerundt commented 5 years ago

Moved to contao/contao