Overview
SkinCitizen is the main skin class for Citizen, extending MediaWiki’s SkinMustache to provide a modern, customizable skin with support for themes, client preferences, and component-based rendering.
Namespace: MediaWiki\Skins\Citizen
Location: includes/SkinCitizen.php
Constructor
TheSkinCitizen class uses dependency injection to receive all required services.
Factory for creating User objects
Cache for user gender information
Service for looking up user identities
Factory for language variant conversion
Utilities for language name handling
Manager for user permissions
Registry for checking loaded extensions
Manager for user group information
Utilities for URL manipulation
MobileFrontend context (optional dependency)
Skin configuration options. If not set, defaults to
['name' => 'citizen']Key Methods
initPage
Initializes the skin for the current page, adding metadata like theme colors and web app manifest.The OutputPage object to initialize
getHtmlElementAttributes
Gets HTML element attributes for the<html> tag, including theme and client preference classes.
Associative array of HTML attributes including CSS classes for theme, header position, and client preferences
getTemplateData
Builds the complete template data array for Mustache rendering, including all components.Complete template data including component data for footer, main menu, page heading, page tools, search box, site stats, user info, sticky header, body content, and table of contents
data-footer: Footer component datadata-main-menu: Main menu component datadata-page-footer: Page footer component datadata-page-heading: Page heading component datadata-page-sidebar: Page sidebar component datadata-page-tools: Page tools component datadata-search-box: Search box component datadata-site-stats: Site statistics component datadata-user-info: User info component datadata-sticky-header: Sticky header component datadata-body-content: Body content component datadata-toc: Table of contents component datatoc-enabled: Boolean indicating if TOC is enabled
Configuration Constants
CLIENTPREFS_THEME_MAP
Maps theme preference values to CSS class suffixes.DEFAULT_CLIENT_PREFS
Default client preference values applied to the HTML element.OPTIONAL_FONT_MODULES
Maps configuration keys to optional font module names.Protected Methods
runOnSkinTemplateNavigationHooks
Ensures theonSkinTemplateNavigation hook runs after all other SkinTemplateNavigation hooks.
The skin template instance
Reference to content navigation array that will be modified
Related
- Components - Learn about Citizen component classes
- Hooks - Learn about hook handlers
- ApiWebappManifest - Web app manifest API