To simplify and make code reusable all menu elements should be built
by using Builder pattern. This a first step, first we the pageActions
methods should return Group object/IMenuElement objects, then in the
second step we will extract this logic into Director/Builder
classes leaving SkinMinerva class much smaller.
Bug: T221792
Change-Id: Ic51c4ca4139919fc3c5f3ada8b1b2fe5d23031d7
The Group shouldn't depend upon concrete MenuEntry definition.
Different Menus can present different MenuElements. Code should
allow easy extensions, not limit only to single MenuEntry
definition.
Changes:
- introduced IMenuEntry interface
- MenuEntry implements IMenuEntry
- removed isJSOnly from logic as it's related only to one menu
element (Watchstar) and Group shouldn't be aware of some special
handling for some elements. The IMenuEntry shouldn't define this
method
- getName, getComponents, getCSSClasses should have defined return
types
Bug: 1221792
Change-Id: I0646df734e869c26bfa8c3a772200e8258a8acce
The check to verify uniqness of the MenuEntry $name existed
twice, in insert() and in insideAfter() methods. To respect
"do not repeat" yourself rule, we should keep this check
in one place only.
Bug: T221792
Change-Id: I973b0427623e579f97ae47f7c80dc2a9db2fcca7
Looks like Title::newFromText() can return null instead
of Title object. Code has to support this edge case.
Bug: T222407
Change-Id: Ie34a26303df8e27247e51ddc2b13e3c2fa59a435
The Commmunity Portal main menu element should be handled
same way as Skin::buildSideBar() does:
- it should ignore "-" -> this is how editors disable the
link
- it should use inContentLanguage() to properly support
different languages
Bug: T216152
Change-Id: I41b2373fd1b55d9d4beaba60eeb362e6188d24de
Cleanup ranges from removal of unused variables, fixing of method
case mismatch, collapsing of multiple `if` statement that can be
combined into one.
Change-Id: Ib9d6e2e4d747da699067c0c0a9aab5e8af29aef2
We decided to remove the Recent Changes menu entry from Advanced
menu for now, we might come back to it later.
For more info: https://phabricator.wikimedia.org/T216152#5123296
Bug: T216152
Change-Id: I6342e273fdc5f483692de6e1ac238c38d06f3e5f
Changes:
- introduced new icon for Community Portal
- added new menu entry in Advanced Builder that links to
MediaWiki:Portal-url
Bug: T216152
Change-Id: Id38836d8f1a62d4e15181ab10e219d5c5b769ec3
Changes:
- moved all menu elements definitions from SkinMinerva into
a separate Definitions.php file
- moved menu building from SkinMinerva into includes/menu/Main
folder
- introduced Builder pattern for easy menu building
Minerva/Menu/Main/Director takes an Minerva/Menu/Main/IBuilder
and builds the menu. The IBuilders use definitions from
Minerva/Menu/Definitions file, so all definitions can be shared
across different menus
- used ServiceWiring file to register MainMenu Director as Service
- left class_alias for old MenuBuilder as some extensions still use it
- The hooks system have to stay like that as some extensions
are using it (BlueSpiceMultiUpload and GrowthExperiments).
- introduced AdvancedMenu builder for the AMC mode
Bug: T216152
Change-Id: I210c3f1fa36bbd2f9108d728b12cbb21ee210354