Skip to content

Render the language portlet's SkinAfterPortlet content (Wikibase Edit/Add links)#488

Merged
malberts merged 1 commit into
5.xfrom
wikibase-language-portlet-link-5.x
Jun 11, 2026
Merged

Render the language portlet's SkinAfterPortlet content (Wikibase Edit/Add links)#488
malberts merged 1 commit into
5.xfrom
wikibase-language-portlet-link-5.x

Conversation

@malberts

@malberts malberts commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Problem

In most skins, Wikibase Client adds an "Edit links" / "Add links" entry to the
"In other languages" menu, linking to the connected repository item so editors
can add or edit interlanguage links. In Chameleon this link never appears.

For #316.

Cause

NavbarHorizontal\LangLinks builds the language menu purely from the
language_urls template data and never calls Skin::getAfterPortlet( 'lang' ),
so the output of the SkinAfterPortlet hook is discarded. That hook is where
Wikibase contributes its link (and where any extension may add to the language
portlet). The contribution is also present when the page has no language links
of its own (the "Add links" case), which the component dropped completely by
returning early.

Change

  • Surface getAfterPortlet( 'lang' ) in LangLinks, including when the page
    has no language links, while still emitting nothing when there is neither a
    list nor a contribution.
  • Style the contributed link as a dropdown item: Chameleon wraps its own menu
    items in a div, while a SkinAfterPortlet contribution arrives in a span,
    so the styling rule matches both.

Generic SkinAfterPortlet support for the language portlet, not
Wikibase-specific: the contributed HTML is passed through untouched, so
Wikibase's own link-item JS still enhances the "Add links" link.

Backport of the master change to the 5.x line. The relevant code is identical
between the two, so the change applies unmodified.

Verification

  • Unit test: the after-portlet contribution is rendered even when the page has
    no language links of its own.
  • UI (Playwright) against a local Wikibase repository + client on Chameleon
    5.0.2: a connected page shows the language list followed by "Edit links"; an
    unconnected page shows "Add links".

UI (Playwright), connected page "Berlin":
realistic-berlin-edit-links-5 0 2

@malberts malberts force-pushed the wikibase-language-portlet-link-5.x branch 4 times, most recently from 3df20d6 to 3388af8 Compare June 10, 2026 21:06
NavbarHorizontal\LangLinks rendered only the language_urls list and
discarded the SkinAfterPortlet hook output for the `lang` portlet, so the
Wikibase Client "Edit links" / "Add links" repository link (and anything
else contributing to that portlet) never appeared in the language menu.
The contribution is also present when the page has no language links of
its own, which the early return dropped entirely.

Surface getAfterPortlet('lang') in the component, and style the
contributed link as a dropdown item to match the language entries. The
link markup is left untouched so Wikibase's link-item JS, which binds to
.wb-langlinks-link > a, keeps working.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@malberts malberts force-pushed the wikibase-language-portlet-link-5.x branch from 3388af8 to 6e45a2c Compare June 11, 2026 08:54
@malberts malberts marked this pull request as ready for review June 11, 2026 09:22
@malberts malberts merged commit d5bd987 into 5.x Jun 11, 2026
8 checks passed
@malberts malberts deleted the wikibase-language-portlet-link-5.x branch June 11, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant