contao/core-bundle

Bug in MetaWizard widget

pgerundt opened this issue · 1 comments

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:

opt.getElement('option[value=' + li.getProperty('data-language') + ']').removeProperty('disabled');

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:

But instead the active languages should be added with the "disabled" attribute to the select:

$options[] = '<option value="' . $k . '">' . $v . '</option>';

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

Moved to contao/contao