Service
Creates Views and broadcasts the render event.
class Service implements ContainerAwareuse ContainerSetter- Copyright
- 2015-2016 Appertly
- License
- Apache-2.0
Constructors / Destructors
| Returns | Signature and Description |
|---|---|
void | __construct()Creates a new ViewService. |
Instance Methods
| Returns | Signature and Description |
|---|---|
void | clearFlashMessages()Clears Flash Messages. |
ConstVector<Block> | getBlocks()Gets all blocks registered for a given region |
ConstVector<DbRefResolver> | Gets any |
?ServerRequestInterface | Gets the last request that the Dispatcher sent to a controller. |
ConstVector<EntityLinker> | Gets any |
ConstMap<string,ImmVector<string>> | Gets any flash messages in the session keyed by status. |
Page | getPage()Gets the Page for this request (created lazily). |
void | Keeps all current flash messages for the next request. |
void | setFlashMessage(, , )Sets a Flash Message. |
| Returns | Signature and Description |
|---|---|
Awaitable<Vector<mixed>> | callPageVisitors()Calls the page visitors. |
string | getPageTitle()Generates a page title. |
Method Details
__construct
__construct(?Container $container)Creates a new ViewService.
| Name | Type | Description |
|---|---|---|
$container | ?Container | The dependency injection container |
callPageVisitors
callPageVisitors(Page $page)Calls the page visitors.
| Name | Type | Description |
|---|---|---|
$page | Page | The page to visit |
| Type | Description |
|---|---|
Awaitable<Vector<mixed>> |
clearFlashMessages
clearFlashMessages(bool $current = false)Clears Flash Messages.
| Name | Type | Description |
|---|---|---|
$current | bool | Whether to add message to the current request |
getBlocks
getBlocks(string $region)Gets all blocks registered for a given region
| Name | Type | Description |
|---|---|---|
$region | string | The region to search |
| Type | Description |
|---|---|
ConstVector<Block> | The found blocks in that region, or an empty array. |
getDbRefResolvers
getDbRefResolvers()Gets any Labrys\Db\DbRefResolver objects in the container.
- Since
- 0.5.0
| Type | Description |
|---|---|
ConstVector<DbRefResolver> | The DbRefResolver objects found. |
getDispatchedRequest
getDispatchedRequest()Gets the last request that the Dispatcher sent to a controller.
- Since
- 0.6.3
| Type | Description |
|---|---|
?ServerRequestInterface | The last dispatched request, or |
getEntityLinkers
getEntityLinkers()Gets any Labrys\View\EntityLinker objects in the container.
- Since
- 0.5.0
| Type | Description |
|---|---|
ConstVector<EntityLinker> | The EntityLinker objects found. |
getFlashMessages
getFlashMessages()Gets any flash messages in the session keyed by status.
| Type | Description |
|---|---|
ConstMap<string,ImmVector<string>> | ImmMap of flash messages |
getPage
getPage(Stringish $title)Gets the Page for this request (created lazily).
| Name | Type | Description |
|---|---|---|
$title | Stringish | The page title |
| Type | Description |
|---|---|
Page | A Page |
getPageTitle
getPageTitle(?Stringish $title)Generates a page title.
| Name | Type | Description |
|---|---|---|
$title | ?Stringish | The page title |
| Type | Description |
|---|---|
string | The formatted page title |
keepFlashMessages
keepFlashMessages()Keeps all current flash messages for the next request.
setFlashMessage
setFlashMessage(string $name, string $value, bool $current = false)Sets a Flash Message.
| Name | Type | Description |
|---|---|---|
$name | string | The status |
$value | string | The message |
$current | bool | Whether to add message to the current request |