This feature add an option `notranslations` that allows the category
tree only to show the default pages and not include their translations
equivalents on the tree. For example let's say we have a page (Test_page)
that was created in a default language "en" in a category TestCat, and has
translations listed: Test_page/es, Test_page/de, Test_page/ar etc.
Doing `<categorytree notranslations="on">TestCat</categorytree> will render
only the Test_page page with it's link to the page on the tree and nothing
more.
Note: If page "Foo/hu" exist but "Foo" doesn't, it should include "Foo/hu"
in the category tree. In most case though, a base page will exist.
Also, the feature is only available if Extension:Translate is made
available on that wiki.
TODO: If "notranslations" is used along side with "showcount", consider
subtracting the number of pages suppressed from the total page count
in the category tree for consistency.
Bug: T229265
Change-Id: Ib4e7ab6ad98c05857cda1cd98bbc19e0504677bb
Use LinkRenderer instead of manually re-implementing parts of it and
manually building the <a> tags to create links.
Aside from technical debt cleanup, this will cause "stub" and "mw-
redirect" classes to get added to the <categorytree> output.
Bug: T25771
Change-Id: I1c644ef364818c4202dc0e30602d557dbec46010
Using LinkRenderer.php instead of compiling links manually gives the
HtmlPageLinkRendererBegin hook a chance to be called. This enables
compatibility with the DisplayTitle extension.
Change-Id: I67633d1add6d1409eac6962a7bd854c3cc93d5ff
Deprecated methods that have been replaced are;
* ConfigFactory::getDefaultInstance()
* wfMemcKey()
This extension uses 1.33 of core and these replacements
are safe.
Change-Id: I1536ab2adecc79fd42b46e2c892dae4a536c9496
This was internal to CategoryTree JS code and only needed on very
few pages. Export it as part of the module that needs it, instead.
Given this is computed and not a plain config var, use callback
to generate the value.
Bug: T219342
Change-Id: I790a98128b0a3317e27ac0d5fda08d48aeb640dc
It has origins in times when this code was in an AJAX function, however
now that it's in an API module it's not needed and can be counter-productive
as headers issued might conflict with MW headers. Let the API take care of
this via its standard means.
Change-Id: I8ebf8e7b935d7d252ac010bc1b88202b87f43e20
This changes the title attribute on the link generated in the
CategoryTree. The only effect is additional information about the
link target that may be truncated by 'hideprefix' or CSS overflow,
will now still be accessible in another way.
Change-Id: I4f07fa88f0a528634e9bf3c504e84fb4bf55e3bf
* Add @inheritDoc to functions that are inheritance.
* Move comments to a single line.
Remove the phpcs rule exceptions:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: I742ee19f0a3d2d62e08b6f2e35cd9a6b3940cd22
This change adds the needed modules to the page in the same hook
that adds the category tree HTML.
This avoids loading the modules on skins without a sidebar, like
SkinApi, or on pages without categories.
A forced-loading of the modules from BeforePageDisplay hook is not
necessary anymore in those cases.
This change avoids getting the OutputPage object from the global $wgOut.
Bug: T212820
Change-Id: I2bd50c45aa201a06630af3d57c9bcfccf7b22b99
This change allows the skin to customize if there is a sidebar or not.
For example the SkinApi overloads buildSidebar and therefor the hook
SkinBuildSidebar is not triggered.
Change-Id: Ib39736901f25822d40265ccaa5fd0feea977cdc1
The hook `SkinJoinCategoryLinks` is not used and not triggered.
Also remove the style for the class CategoryTreeCategoryBarItem because
it is only used in skinJoinCategoryLinks::skinJoinCategoryLinks.
Change-Id: I52e4f819ff195fc1fa8a148b0bb58d95a4bf22d7
Also rename the style module from 'ext.categoryTree.css' to
'ext.categoryTree.styles'.
Keep the previous module name 'ext.categoryTree.css' for compability to
cached versions.
Also move the files of the module 'ext.categoryTree' into a
subdirectory ext.categoryTree.
Change-Id: Ie5ea28acfb43e33a94ec5824baf4f26d63d8e9e6
When giving an invalid title, for example containing double encoded %
(%2527 from the task), the code would raise a BadMethodCallException on
the null title.
It is better to get an api error, when invalid title is given, because
that is more informativ for the client than a php fatal
Bug: T202057
Change-Id: I7af2a8d072216eca8d3241b2c082089a78fbf621
Try also to ensure that the bullet messages are treated the
same in both JS and PHP. It should be noted that the mk and scn
translations are currently broken on the JS side.
Bug: T195010
Change-Id: Id87d26db8d90e293701ae11f6434026a8ae88822
Doesn't seem to serve any useful purpose
and adds an unwanted trailing <p></p> after the category tree
Change-Id: Ic76ff3b1156a5627930c1078e488f5c81ec5521d
Register all hooks unconditionally in extension.json, and then in the
hook
itself, check whether they should be doing anything.
Change-Id: I5f0019fc444371a24a11a25ca2d980c0a9ab5a61
The following sniffs now pass and were enabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag
Change-Id: I13c4825186d8ba101feb2a2d28ee8dc9bc7306dd
Not referenced anywhere in Wikimedia Git, except for the one
method that uses it, in the same class here.
Also:
* Set explicit 'public' visibility of getOptionsAsJsStructure().
* Avoid use of !is_null().
* Avoid assignment in ternary.
Change-Id: I71d2a247e001b7f7f4f52546e8167a79d873076e