Skip to content

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

Merged
malberts merged 1 commit into
masterfrom
wikibase-language-portlet-link
Jun 11, 2026
Merged

Render the language portlet's SkinAfterPortlet content (Wikibase Edit/Add links)#487
malberts merged 1 commit into
masterfrom
wikibase-language-portlet-link

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.

This is 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.

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: 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-master

@malberts malberts force-pushed the wikibase-language-portlet-link branch 3 times, most recently from ba470e9 to 70086f4 Compare June 10, 2026 21:07
@malberts malberts marked this pull request as ready for review June 10, 2026 21:34
@malberts malberts marked this pull request as draft June 10, 2026 21:58
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 branch from 70086f4 to b87c827 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 fede165 into master Jun 11, 2026
5 checks passed
@malberts malberts deleted the wikibase-language-portlet-link 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