tp TouchPointWP Settings - TenthPres/TouchPoint-WP GitHub Wiki
tp\TouchPointWP\Settings
The Settings class - most settings are available through the default getter.
- Full name:
\tp\TouchPointWP\Settings
Constants
| Constant | Visibility | Type | Value |
|---|---|---|---|
UNDEFINED_PLACEHOLDER |
public | INF |
Properties
parent
The main plugin object.
public ?\tp\TouchPointWP\TouchPointWP $parent
Methods
__construct
Constructor function.
public __construct(\tp\TouchPointWP\TouchPointWP $parent): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$parent |
\tp\TouchPointWP\TouchPointWP | Parent object. |
instance
Main TouchPointWP_Settings Instance
public static instance(?\tp\TouchPointWP\TouchPointWP $parent = null): \tp\TouchPointWP\Settings
Ensures only one instance of TouchPointWP_Settings is loaded or can be loaded.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$parent |
?\tp\TouchPointWP\TouchPointWP | Object instance. |
Return Value:
instance
See Also:
- \tp\TouchPointWP\TouchPointWP()
initSettings
Initialize settings
public initSettings(bool $withStrings = false): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$withStrings |
bool | Indicates that labels need to be included |
hasValidApiSettings
Indicates whether there are adequate settings in place for API calls.
public hasValidApiSettings(): bool
addMenuItems
Add settings page to admin menu
public addMenuItems(): void
configureSettings
Container for settings page arguments
public configureSettings(?array $settings = []): array
Parameters:
| Parameter | Type | Description |
|---|---|---|
$settings |
?array | Settings array. |
addSettingsLink
Add settings link to plugin list table
public addSettingsLink(array $links): array
Parameters:
| Parameter | Type | Description |
|---|---|---|
$links |
array | Existing links. |
Return Value:
Modified links.
__get
public __get(string $what): string|false
Parameters:
| Parameter | Type | Description |
|---|---|---|
$what |
string | The field to get a value for |
Return Value:
The value, if set. False if not set.
get
Returns the setting, including default values. Returns false if the value is undefined.
public get(string $what): false|string|array
Parameters:
| Parameter | Type | Description |
|---|---|---|
$what |
string |
set
public set(string $what, mixed $value, ?bool $autoload = null): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
$what |
string | |
$value |
mixed | |
$autoload |
?bool |
migrate
Migrate settings from version to version. This may be called even when a migration isn't necessary.
public migrate(): void
updateDeployedScripts
Generate new scripts and deploy to TouchPoint.
public updateDeployedScripts(): void
Throws:
registerSettings
Register plugin settings
public registerSettings(): void
settings_section
Settings section.
public settings_section(array $section): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$section |
array | Array of section ids. |
settingsPage
Load settings page content.
public settingsPage(): void
validation_lowercase
Force a value to lowercase; used as a validator
public validation_lowercase(string $data): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$data |
string | Mixed case string |
Return Value:
lower-case string
__clone
Cloning is forbidden.
public __clone(): mixed
__wakeup
Unserializing instances of this class is forbidden.
public __wakeup(): mixed