Application

Reference for the Application module: build the shell of a web application from a themed root, with a menu, page titles, routes, and navigation buttons and links.

This page is a pure reference. For how the framework fits together, see the Guide.

Classes

ApplicationUi

Core application UI components. Render the themed application root, its main content area and intro screen, apply a theme to a block of content, and register routes for the application.

Content

ApplicationUi::Content(callable $content): void

Render the main content area, showing status messages above the given content.

NameTypeDescription
$contentcallableA callback that outputs the content of the area.

Returns void

Intro

ApplicationUi::Intro(int $durationMs, callable $content): void

Render an intro screen that overlays the given content for a duration.

NameTypeDescription
$durationMsintHow long the intro screen is shown, in milliseconds.
$contentcallableA callback that outputs the intro content.

Returns void

Render

ApplicationUi::Render(UiThemeData $theme, callable $children): void

Render the application root: the html and body document, the resolved theme, the title from config, and the given children.

NameTypeDescription
$themeUiThemeDataThe theme, with its variants, applied to the application.
$childrencallableA callback that outputs the body of the application.

Returns void

Route

ApplicationUi::Route(string $path, callable|string $pageUiCallback): void

Register a route for the application. An empty or slash path becomes the index route; any other path is registered as a file route.

NameTypeDescription
$pathstringThe path to register the route at.
$pageUiCallbackcallable|stringA callback, or a callable name, that renders the page.

Returns void

Theme

ApplicationUi::Theme(UiThemeVariantData $theme, callable $children): void

Apply a theme variant to a block of application content, rendering the children within it.

NameTypeDescription
$themeUiThemeVariantDataThe theme variant to apply.
$childrencallableA callback that outputs the themed content.

Returns void

ApplicationButtonUi

Button components for application navigation. Render a button styled link, or a plain link, that navigates to a path.

Functions
ApplicationButtonUi::Link(string $goToPath, callable $content): void

Render a button styled link that navigates to a path.

NameTypeDescription
$goToPathstringThe path the button navigates to.
$contentcallableA callback that outputs the button label.

Returns void

LinkButton

ApplicationButtonUi::LinkButton(string $goToPath, callable $content): void

Render a plain, non button styled link that navigates to a path.

NameTypeDescription
$goToPathstringThe path the link navigates to.
$contentcallableA callback that outputs the link content.

Returns void

ApplicationMenuUi

Menu components for application navigation. Render the application menu wrapper, and menu links that navigate to a path.

Functions
ApplicationMenuUi::Link(string $goToPath, callable $content): void

Render a menu link that navigates to a path.

NameTypeDescription
$goToPathstringThe path the menu link navigates to.
$contentcallableA callback that outputs the menu link content.

Returns void

Render

ApplicationMenuUi::Render(UiThemeVariantData $menuTheme, callable $children): void

Render the application menu, wrapping the given children in the menu navigation.

NameTypeDescription
$menuThemeUiThemeVariantDataThe theme variant applied to the menu.
$childrencallableA callback that outputs the menu links.

Returns void

ApplicationPageUi

Page components for applications. Render page level structure such as the page title.

Functions

Title

ApplicationPageUi::Title(string $title, ?callable $optionalLeftContent = null): void

Render a page title, with optional content shown to its left.

NameTypeDescription
$titlestringThe page title text.
$optionalLeftContent?callableA callback that outputs content to the left of the title, or null for none.

Returns void