Nextcloud PHP API (master)

IInitialStateService

Tags
since
16.0.0
deprecated
21

Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider

see
IInitialState

Table of Contents

Methods

provideInitialState()  : void
Allows an app to provide its initial state to the template system.
provideLazyInitialState()  : void
Allows an app to provide its initial state via a lazy method.

Methods

provideInitialState()

Allows an app to provide its initial state to the template system.

public provideInitialState(string $appName, string $key, bool|int|float|string|array<string|int, mixed>|JsonSerializable $data) : void

Use this if you know your initial state sill be used for example if you are in the render function of you controller.

Parameters
$appName : string
$key : string
$data : bool|int|float|string|array<string|int, mixed>|JsonSerializable
Tags
since
16.0.0
deprecated
21

Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider

see
IInitialState::provideInitialState()

provideLazyInitialState()

Allows an app to provide its initial state via a lazy method.

public provideLazyInitialState(string $appName, string $key, Closure $closure) : void

This will call the closure when the template is being generated. Use this if your app is injected into pages. Since then the render method is not called explicitly. But we do not want to load the state on webdav requests for example.

Parameters
$appName : string
$key : string
$closure : Closure

returns a primitive or an object that implements JsonSerializable

Tags
since
16.0.0
deprecated
21

Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider

see
IInitialState::provideLazyInitialState()

        
On this page

Search results