GravityKit\GravityView\Settings\ViewSettings
The View Settings class.
Since:
2.03.0.0(Migrated to GravityKit\GravityView\Settings namespace.)
Source: src/Settings/ViewSettings.php:20
Details
- Kind:
class - Namespace:
GravityKit\GravityView\Settings - Extends:
Settings
Methods
| Method | Description |
|---|---|
declares_array_value() | Whether a registered View setting declares that it holds an array. |
with_defaults() | Retrieve an instance of the settings with default values. |
defaults() | Retrieve the default View settings. |
Method Reference
declares_array_value()
public static function declares_array_value( $setting ): bool
Whether a registered View setting declares that it holds an array.
checkboxes settings post one key per choice, and any setting may
declare an array default; everything else is treated as scalar. A
custom setting type that posts one input per choice must therefore
declare an array default, and be registered during save requests
(not only while rendering its own admin screen), or its value is
rejected on write.
Both write paths consult this: the classic post.php save via
ViewStyles::sanitize_payload(), and the Abilities/REST write via
InspectorRoute::validate_template_setting_value().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$setting | mixed | Registered setting definition, or null when the key is not registered. |
Returns
bool
Since: 3.3.2
Source: src/Settings/ViewSettings.php:41
with_defaults()
public static function with_defaults( $detailed=false )
Retrieve an instance of the settings with default values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$detailed | bool | false | Whether to return detailed setting meta information or just the value. |
Returns
\GV\View_Settings
Since: 2.0
Source: src/Settings/ViewSettings.php:63
defaults()
public static function defaults( $detailed=false, $group=null )
Retrieve the default View settings.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$detailed | bool | false | Whether to return detailed setting meta information or just the value. |
$group | string | null | Retrieve settings of a particular group. |
Returns
array— { The default settings along with their values.
Since: 2.0
Source: src/Settings/ViewSettings.php:91