Skip to content

Commit

Permalink
Merge branch 'release/1.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Mar 14, 2022
2 parents 89673d3 + 3f89d3b commit 8fb145e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.1.9
## 03/14/2022

1. [](#new)
* Added support for flex router to return a response instead of a page

# v1.1.8
## 01/28/2022

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Flex Objects
slug: flex-objects
type: plugin
version: 1.1.8
version: 1.1.9
description: Flex Objects plugin allows you to manage Flex Objects in Grav Admin.
icon: list-alt
author:
Expand Down
8 changes: 7 additions & 1 deletion flex-objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public function onPagesInitialized(Event $event): void
$router = $options['router'] ?? null;
if (\is_string($router)) {
$path = implode('/', array_reverse($path));
$response = null;
$flexEvent = new Event([
'flex' => $this->grav['flex'],
'parent' => $page,
Expand All @@ -321,9 +322,14 @@ public function onPagesInitialized(Event $event): void
'path' => $path,
'route' => $route,
'options' => $options,
'request' => $event['request']
'request' => $event['request'],
'response' => &$response,
]);
$flexEvent = $this->grav->fireEvent("flex.router.{$router}", $flexEvent);
if ($response) {
$this->grav->close($response);
}

/** @var PageInterface|null $routedPage */
$routedPage = $flexEvent['page'];
if ($routedPage) {
Expand Down

0 comments on commit 8fb145e

Please sign in to comment.