Page MenuHomePhabricator

Provide categories as data array rather than string
Closed, ResolvedPublic

Description

Currently categories must be rendered as a chunk of HTML with no ability to customize the output e.g. to provide different handling when there are no categories to display.

Use case: rendering a section like so is not possible:

<h2>Categories</h2>
{{^has-categories}}No categories found.{{/^has-categories}}
{{#categories}}{{{html}}}{{/categories}

We should give more flexibility to skin developers, possibly making it consistent with other menu code such as sidebar/footer.

See also https://www.mediawiki.org/wiki/Topic:Wbk8a97qbn5fxczs

Event Timeline

Change 726995 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] WIP: Add Sidebar and Portlets components and MenuDirector

https://gerrit.wikimedia.org/r/726995

Change 752216 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Categories are modelled as a portlet

https://gerrit.wikimedia.org/r/752216

Change 752216 merged by jenkins-bot:

[mediawiki/core@master] Categories are modelled as a portlet

https://gerrit.wikimedia.org/r/752216

Change 754143 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] Revert \"Categories are modelled as a portlet\"

https://gerrit.wikimedia.org/r/754143

Change 754143 merged by jenkins-bot:

[mediawiki/core@master] Revert \"Categories are modelled as a portlet\"

https://gerrit.wikimedia.org/r/754143

Reverted because this broke action=parse API while using the new Vector skin (T299352#7626761). Displaying the categories in the API request now requires calling into the current skin's portlet generation code, and Vector's code doesn't seem to expect to be called in such context.

Change 754586 had a related patch set uploaded (by Bartosz Dziewoński; author: Jdlrobson):

[mediawiki/core@master] Revert \"Revert \"Categories are modelled as a portlet\"\"

https://gerrit.wikimedia.org/r/754586

Change 754586 merged by jenkins-bot:

[mediawiki/core@master] Revert \"Revert \"Categories are modelled as a portlet\"\"

https://gerrit.wikimedia.org/r/754586

The change has been re-applied.

Should this be marked as resolved?

Jdlrobson claimed this task.

Yep! Thanks!

Change 726995 abandoned by Jdlrobson:

[mediawiki/core@master] WIP: Add Sidebar and Portlets components and MenuDirector

Reason:

See https://phabricator.wikimedia.org/T302116

https://gerrit.wikimedia.org/r/726995