class Flash (View source)

Provide a way to flash data into the session for the next request.

Constants

CURRENT_KEY

Keys for different request contexts.

NEXT_KEY

Methods

__construct(array|ArrayAccess $store, string $store_key = '__wpemergeFlash')

Constructor.

array|ArrayAccess
getStore()

Get the store for flash messages.

void
setStore(array|ArrayAccess $store)

Set the store for flash messages.

boolean
enabled()

Get whether the flash service is enabled.

void
add(string $key, mixed $new_items)

Add values for a key for the next request.

addNow(string $key, mixed $new_items)

Add values for a key for the current request.

mixed
get(string|null $key = null, mixed $default = [])

Get the entire store or the values for a key for the current request.

mixed
getNext(string|null $key = null, mixed $default = [])

Get the entire store or the values for a key for the next request.

void
clear(string|null $key = null)

Clear the entire store or the values for a key for the current request.

void
clearNext(string|null $key = null)

Clear the entire store or the values for a key for the next request.

void
shift()

Shift current store and replace it with next store.

void
save()

Save flashed data to store.

Details

__construct(array|ArrayAccess $store, string $store_key = '__wpemergeFlash')

Constructor.

Parameters

array|ArrayAccess $store
string $store_key

array|ArrayAccess getStore()

Get the store for flash messages.

Return Value

array|ArrayAccess

void setStore(array|ArrayAccess $store)

Set the store for flash messages.

Parameters

array|ArrayAccess $store

Return Value

void

boolean enabled()

Get whether the flash service is enabled.

Return Value

boolean

void add(string $key, mixed $new_items)

Add values for a key for the next request.

Parameters

string $key
mixed $new_items

Return Value

void

addNow(string $key, mixed $new_items)

Add values for a key for the current request.

Parameters

string $key
mixed $new_items

mixed get(string|null $key = null, mixed $default = [])

Get the entire store or the values for a key for the current request.

Parameters

string|null $key
mixed $default

Return Value

mixed

mixed getNext(string|null $key = null, mixed $default = [])

Get the entire store or the values for a key for the next request.

Parameters

string|null $key
mixed $default

Return Value

mixed

void clear(string|null $key = null)

Clear the entire store or the values for a key for the current request.

Parameters

string|null $key

Return Value

void

void clearNext(string|null $key = null)

Clear the entire store or the values for a key for the next request.

Parameters

string|null $key

Return Value

void

void shift()

Shift current store and replace it with next store.

Return Value

void

void save()

Save flashed data to store.

Return Value

void