IInitialState

interface OCP\AppFramework\Services\IInitialState
Implemented by:OC\AppFramework\Services\InitialState
Source:lib/public/AppFramework/Services/IInitialState.php#36

Methods

public OCP\AppFramework\Services\IInitialState::provideInitialState($key, $data)
Allows an app to provide its initial state to the template system.
Use this if you know your initial state sill be used for example if
you are in the render function of you controller.
Source:

lib/public/AppFramework/Services/IInitialState.php#48

Parameters:
  • $key (string)
  • $data (bool | int | float | string | array | \JsonSerializable)
Since:

20.0.0

public OCP\AppFramework\Services\IInitialState::provideLazyInitialState($key, $closure)
Allows an app to provide its initial state via a lazy method.
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.
Source:

lib/public/AppFramework/Services/IInitialState.php#63

Parameters:
  • $key (string)
  • $closure (Closure) returns a primitive or an object that implements JsonSerializable
Since:

20.0.0