Page MenuHomePhabricator

BetaFeatures: the VisualEditor section appears before the introduction
Closed, ResolvedPublic


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).

Version: master
Severity: minor


VisualEditor_as_BetaFeature_placement_bug.png (768×1 px, 96 KB)



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:42 AM
bzimport added a project: BetaFeatures.
bzimport set Reference to bz71088.

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

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

Change 161685 had a related patch set uploaded by Seb35:
Check the existence of BetaFeatures before adding the 'visualeditor-enable' preference

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