# danog\MadelineProto\WebUI\Page: A page of the web UI: what the builtin login and status pages show.

> 
The page is rendered on the server by the template named by {@see self::$template} (by default `page`), which
gets it in the `$page` variable; in the browser, the web app renders it again with the view named by
{@see self::$view} (by default `setup`), from its JSON serialization.


[Back to index](../../../index.html)

> Author: Daniil Gentili <daniil@daniil.it>  
  

A page of the web UI: what the builtin login and status pages show.  


The page is rendered on the server by the template named by {@see self::$template} (by default `page`), which
gets it in the `$page` variable; in the browser, the web app renders it again with the view named by
{@see self::$view} (by default `setup`), from its JSON serialization.


## Properties
* `$title`: `string` 
* `$lead`: `(danog\MadelineProto\WebUI\SafeHtml | string)` 
* `$step`: `?danog\MadelineProto\WebUI\Step` 
* `$fields`: `array` 
* `$submit`: `?string` 
* `$alerts`: `array` 
* `$actions`: `array` 
* `$instructions`: `array` 
* `$qrEndpoint`: `?string` 
* `$template`: `string` 
* `$view`: `string` 
* `$data`: `array` 
* `$sessions`: `array` 
* `$session`: `?string` 

## Method list:
* [`__construct(string $title, (string|\danog\MadelineProto\WebUI\SafeHtml) $lead = '', ?\danog\MadelineProto\WebUI\Step $step = NULL, list<\danog\MadelineProto\WebUI\Field> $fields = [], ?string $submit = NULL, list<\danog\MadelineProto\WebUI\Alert> $alerts = [], list<\danog\MadelineProto\WebUI\Action> $actions = [], list<(string|\danog\MadelineProto\WebUI\SafeHtml)> $instructions = [], ?string $qrEndpoint = NULL, string $template = 'page', string $view = 'setup', array<string, mixed> $data = [], array<string, string> $sessions = [], ?string $session = NULL)`](#__construct)
* [`jsonSerialize(): array`](#jsonSerialize)
* [`addAlert(\danog\MadelineProto\WebUI\Alert ...$alerts): \danog\MadelineProto\WebUI\Page`](#addAlert)

## Methods:
### <a name="__construct"></a> `__construct(string $title, (string|\danog\MadelineProto\WebUI\SafeHtml) $lead = '', ?\danog\MadelineProto\WebUI\Step $step = NULL, list<\danog\MadelineProto\WebUI\Field> $fields = [], ?string $submit = NULL, list<\danog\MadelineProto\WebUI\Alert> $alerts = [], list<\danog\MadelineProto\WebUI\Action> $actions = [], list<(string|\danog\MadelineProto\WebUI\SafeHtml)> $instructions = [], ?string $qrEndpoint = NULL, string $template = 'page', string $view = 'setup', array<string, mixed> $data = [], array<string, string> $sessions = [], ?string $session = NULL)`




Parameters:

* `$title`: `string` Title  
* `$lead`: `(string|\danog\MadelineProto\WebUI\SafeHtml)` Introductory text  
* `$step`: `?\danog\MadelineProto\WebUI\Step` Current step of the setup flow, if any  
* `$fields`: `list<\danog\MadelineProto\WebUI\Field>` Form fields  
* `$submit`: `?string` Label of the submit button, or null if the page has no form  
* `$alerts`: `list<\danog\MadelineProto\WebUI\Alert>` Alerts  
* `$actions`: `list<\danog\MadelineProto\WebUI\Action>` Secondary actions of the form  
* `$instructions`: `list<(string|\danog\MadelineProto\WebUI\SafeHtml)>` Ordered list of instructions  
* `$qrEndpoint`: `?string` URL of the QR code login endpoint, to show the QR code login panel  
* `$template`: `string` Template used to render the page on the server  
* `$view`: `string` View used to render the page in the web app  
* `$data`: `array<string, mixed>` Additional variables for custom templates  
* `$sessions`: `array<string, string>` The sessions to choose from (key => name), on the login pages of
                                              {@see \danog\MadelineProto\API::startAndLoopMulti()}: those not
                                              logged in yet  
* `$session`: `?string` Key of the session of the page, among $sessions  


#### See also: 
* [`\danog\MadelineProto\WebUI\SafeHtml`: A trusted HTML fragment, output as-is by templates instead of being escaped.](../../../danog/MadelineProto/WebUI/SafeHtml.html)
* [`\danog\MadelineProto\WebUI\Step`: The steps of the setup flow, shown in the progress rail of the builtin pages.](../../../danog/MadelineProto/WebUI/Step.html)
* [`\danog\MadelineProto\WebUI\Field`: A form field.](../../../danog/MadelineProto/WebUI/Field.html)
* [`\danog\MadelineProto\WebUI\Alert`: A message shown on a page.](../../../danog/MadelineProto/WebUI/Alert.html)
* [`\danog\MadelineProto\WebUI\Action`: A secondary action of a form: a button that submits `name=value` without validating the form fields.](../../../danog/MadelineProto/WebUI/Action.html)




### <a name="jsonSerialize"></a> `jsonSerialize(): array`





### <a name="addAlert"></a> `addAlert(\danog\MadelineProto\WebUI\Alert ...$alerts): \danog\MadelineProto\WebUI\Page`

Add alerts to the page.


Parameters:

* `...$alerts`: `\danog\MadelineProto\WebUI\Alert`   


#### See also: 
* [`\danog\MadelineProto\WebUI\Alert`: A message shown on a page.](../../../danog/MadelineProto/WebUI/Alert.html)




---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
