-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-230 Create GalaxyPlanetLink component
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 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
26 changes: 26 additions & 0 deletions
26
common/components/GalaxyPlanetLink/GalaxyPlanetLink.component.php
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,26 @@ | ||
<?php | ||
|
||
namespace UniEngine\Engine\Common\Components\GalaxyPlanetLink; | ||
|
||
use UniEngine\Engine\Common\Utils\Routing; | ||
|
||
/** | ||
* @param array $props | ||
* @param array $props['coords'] | ||
* @param number $props['coords']['galaxy'] | ||
* @param number $props['coords']['system'] | ||
* @param number $props['coords']['planet'] | ||
*/ | ||
function render($props) { | ||
$linkText = "[{$props['coords']['galaxy']}:{$props['coords']['system']}:{$props['coords']['planet']}]"; | ||
|
||
return buildDOMElementHTML([ | ||
'tagName' => 'a', | ||
'contentHTML' => $linkText, | ||
'attrs' => [ | ||
'href' => Routing\getGalaxyTargetUrl($props['coords']), | ||
], | ||
]); | ||
} | ||
|
||
?> |
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,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
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,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |