SettingsPage
in package
This class maps the page XML element, from our Settings XML schema
It provides method to print a form built from this page and to handle form.
Table of Contents
Properties
- $id : string
- The page ID
- $settings : array<string|int, Setting>
- The settings
- $title : string
- The page's title
Methods
- __construct() : mixed
- Initializes a new instance of SettingsPage class
- fromXml() : SettingsPage
- Initializes a settings page from an SimpleXMLElement XML fragment
- handleForm() : bool
- Handles form reading $_POST array, set new settings values and saves.
- getUnderlyingObject() : object
- saveObjects() : void
Properties
$id
The page ID
public
string
$id
This property maps the id attribute from the page XML tag.
$settings
The settings
public
array<string|int, Setting>
$settings
= []
This property is an array of Setting items and maps the
$title
The page's title
public
string
$title
This property maps the title attribute from the page XML tag.
Methods
__construct()
Initializes a new instance of SettingsPage class
public
__construct(string $id) : mixed
Parameters
- $id : string
fromXml()
Initializes a settings page from an SimpleXMLElement XML fragment
public
static fromXml(SimpleXMLElement $xml) : SettingsPage
Parameters
- $xml : SimpleXMLElement
Return values
SettingsPagehandleForm()
Handles form reading $_POST array, set new settings values and saves.
public
handleForm([array<string|int, string> &$errors = [] ]) : bool
Parameters
- $errors : array<string|int, string> = []
-
an array where the errors will be filled
Return values
bool —true if there isn't error ; otherwise, false.
getUnderlyingObject()
private
getUnderlyingObject(string $object) : object
Parameters
- $object : string
Return values
objectsaveObjects()
private
saveObjects(array<string|int, string> $objects) : void
Parameters
- $objects : array<string|int, string>