Last modified: 2014-09-20 18:15:43 UTC
Created attachment 16526 [details] The VisualEditor section of BetaFeatures appears before the introduction In my experimental setup, the VisualEditor section in the beta features appears as first item, just before the introductory text about beta features. It appears that in the LocalSettings.php I load the VisualEditor extension before the BetaFeatures extension, and exchange the order results in a good placement of the VE as BF (normal order).
Since the VisualEditor registers its preference 'visualeditor-enable' in the standard GetPreferences and in the BF’s GetBetaFeaturePreferences, one is be cancelled. If BF is loaded before VE (and hence BF’s GetPreferences is before VE’s GetPreferences), VE takes care and don’t add again the 'visualeditor-enable'. But if VE is loaded before BF, VE’s GetPreferences first adds its 'visualeditor-enable' then VE’s GetBetaFeaturePreferences erases the previous value and remplaces it by the 'visualeditor-emable' in the BF syntax, but by *keeping* the same place in the $prefs array, so the PreferencesForm loads it in a "wrong" order. Two non-exclusive solutions: 1. in BF, unset the $prefs[$key] before adding it, to restart the order (tested, it works) 2. in VE in onGetPreferences function, add a second condition before adding the 'visualeditor-enable' preference "!AutoLoader::loadClass( 'BetaFeatures' )" (tested, it works)
Yeah. VE should just check for the presence of 'BetaFeatures' class, instead of relying on the order. You can just use class_exists() for that. Want to submit a patch?
Change 161677 had a related patch set uploaded by Seb35: Unset the preference key before adding it https://gerrit.wikimedia.org/r/161677
Oh, I misread your solution 1. That also makes sense. Thanks for the patch!
Change 161677 merged by jenkins-bot: Unset the preference key before adding it https://gerrit.wikimedia.org/r/161677
Change 161685 had a related patch set uploaded by Seb35: Check the existence of BetaFeatures before adding the 'visualeditor-enable' preference https://gerrit.wikimedia.org/r/161685
Thanks for merging, Bartosz. I propose a patch for the second solution also, I find it better to check the existence of BetaFeatures.
Change 161685 merged by jenkins-bot: Check the existence of BetaFeatures before adding the 'visualeditor-enable' preference https://gerrit.wikimedia.org/r/161685
Re-close. Thanks!