Skip to main content

GravityKit\GravityView\Settings\Settings

A generic Settings base class.

Since:

  • 2.0
  • 3.0.0 (Migrated to GravityKit\GravityView\Settings namespace.)

Source: src/Settings/Settings.php:19

Details

  • Kind: class
  • Namespace: GravityKit\GravityView\Settings

Methods

MethodDescription
__construct()Create with new.
update()Mass update values from the allowed ones.
set()Set a setting.
get()Set an setting.
all()Returns all the objects in this collection as an an array.

Method Reference

__construct()

public function __construct( $settings=[] )

Create with new.

Parameters

NameTypeDefaultDescription
$settingsarray[]Initial settings. Default: none.

Returns

  • \GV\Settings

Since: 2.0

Source: src/Settings/Settings.php:34

update()

public function update( $settings )

Mass update values from the allowed ones.

Parameters

NameTypeDefaultDescription
$settingsarrayAn array of settings to update.

Returns

  • \GV\Settings — self chain.

Since: 2.0

Source: src/Settings/Settings.php:49

set()

public function set( $key, $value )

Set a setting.

Parameters

NameTypeDefaultDescription
$keymixedThe key the value should be added under.
$valuemixedThe value to be added to the key.

Returns

  • void

Since: 2.0

Source: src/Settings/Settings.php:66

get()

public function get( $key, $default=null )

Set an setting.

Parameters

NameTypeDefaultDescription
$keymixedThe key in this setting to retrieve.
$defaultmixednullA default in case the key is not set.

Returns

  • mixed | null

Since: 2.0

Source: src/Settings/Settings.php:80

all()

public function all()

Returns all the objects in this collection as an an array.

Returns

  • array — The objects in this collection.

Since: 2.0

Source: src/Settings/Settings.php:91