Closed pgerundt closed 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
metaDelete()
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()
$options[] = '<option value="' . $k . '"' . ($this->varValue[$k] ? ' disabled="disabled"' : '') . '>' . $v . '</option>';
unset()
Moved to contao/contao
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#L2329But 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()