-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from kalibora/support-redirect
Support redirect
- Loading branch information
Showing
8 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* This file is part of the Madapaja.TwigModule package. | ||
* | ||
* @license http://opensource.org/licenses/MIT MIT | ||
*/ | ||
namespace Madapaja\TwigModule\Annotation; | ||
|
||
use Ray\Di\Di\Qualifier; | ||
|
||
/** | ||
* @Annotation | ||
* @Target("METHOD") | ||
* @Qualifier | ||
*/ | ||
final class TwigRedirectPath | ||
{ | ||
public $value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo is {{ foo }}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* This file is part of the Madapaja.TwigModule package. | ||
* | ||
* @license http://opensource.org/licenses/MIT MIT | ||
*/ | ||
namespace Madapaja\TwigModule\Resource\Page; | ||
|
||
use BEAR\Resource\Code; | ||
use BEAR\Resource\ResourceObject; | ||
|
||
class Redirect extends ResourceObject | ||
{ | ||
public function onGet() | ||
{ | ||
$this->body = [ | ||
'foo' => 'bar', | ||
]; | ||
|
||
return $this; | ||
} | ||
|
||
public function onPost() | ||
{ | ||
$this->code = Code::FOUND; | ||
$this->headers['Location'] = '/path/to/baz'; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="refresh" content="0;url={{ url }}" /> | ||
<title>Redirecting to {{ url }}</title> | ||
</head> | ||
<body> | ||
Redirecting to <a href="{{ url }}">{{ url }}</a>. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="refresh" content="0;url={{ url }}" /> | ||
<title>Redirecting to {{ url }}</title> | ||
</head> | ||
<body> | ||
Redirecting to <a href="{{ url }}">{{ url }}</a>. | ||
</body> | ||
</html> |