Architecture:MediaWiki/user interface layer

From mediawiki.org
Jump to navigation Jump to search

The user interface layer is responsible for interacting with the user, typically via a web based graphical user interface. This includes presenting information to the user, typically by rendering data as HTML, presenting input forms, and processing user input submitted from these forms, to convert it to a canonical internal representation.

One key concern of the user interface layer is localization. The corresponding internationalization is often applied in lower layers, in particular the behavior layer.

Status:
As per August 2020, a lot of logic that belongs into the user interface layer is entangled with behavior layer logic, especially in special pages. As code in the user interface layer is refactored to reduce coupling, more code will be factored out and moved to the behavior layer.

Constraints:
Code in the user interface layer should not make use of code in layers above it, such as the entry point layer or the wiring layer.

Dependencies:
Code in the user interface layer may depend on code in layers below it, such as the behavior layer or the persistence layer. It may also make use of the API layer, though it will typically do this indirectly, by making calls to the API using client side JavaScript that is part of the user interface.

Typical patterns:
A typical pattern in the user interface layer are special pages, formatters, and skins.

Example:
An example of user interface code is the SpecialContributions class or the OutputPage class.